web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Barcode Scanning and D...
Power Apps
Unanswered

Barcode Scanning and Duplicates

(0) ShareShare
ReportReport
Posted on by 194

Hi Everyone,

I have an app with the barcode scanner and I've been finding when people are scanning barcodes sometimes they scan duplicates and not catching/removing while scanning. This is a problem because we only want 1 barcode each saved into the database and since a barcode is scanned twice my check to see if the data has the barcode already doesnt work because the cloud doesnt update quick enough to see results before patching the next, duplicated barcode, so I'm left with duplicates in the database.

 

How can the system check, on scan, if the barcode scanned is one already in the active collection you are scanning? So if i'm in camera mode and I scan like this:

123345

32222

32222

....

 

I want the system, when I scan 32222 the second time to be like nope, already exists while scanning so it doesnt even have a chance to patch. Please help!

Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    hey @Nicci 

     

    please try this approach:

     

    onvisible of screen for example
    
    // Clear existing collection or initialize it
    Clear(colScannedBarcodes);

     

    If(
     Not(
     Barcode in colScannedBarcodes.Barcode
     ),
     Collect(colScannedBarcodes, {Barcode: BarcodeScanner1.Value}),
     Notify("This barcode has already been scanned.", NotificationType.Error)
    );

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • Nicci Profile Picture
    194 on at

    Hello! The if statement, is that for on scan?

    It does not recognize 'barcode' at all. Also BarcodeReader1.Value isnt recognized either. I can only do BarcodeReader1.Barcodes, but thats a table, not the value.

     

    Nicci_1-1706800392323.png

     

     

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    can you tr this modification please:

    ForAll(
     BarcodeScanner1.Barcodes,
     If(
     Not(LookUp(colScannedBarcodes, Barcode = Result)),
     Collect(colScannedBarcodes, {Barcode: Result})
     )
    );

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • Nicci Profile Picture
    194 on at

    No errors but when testing nothing is triggering my notification when i scan a tag a second time so not sure if its working. Here is my code for the OnScan property (it is a multi scan barcode reader):

     

    ForAll(
     BarcodeReader1.Barcodes,
     If(
     CountRows(Filter(colScannedBarcodes, Barcode = Value))>0, Notify("Duplicate"),
     Collect(colScannedBarcodes, {Barcode: Value})
     )
    );

     

     

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    ForAll(
    BarcodeReader1.Barcodes,
    // Assuming 'Result' is the correct field name for barcode value in the 'Barcodes' table
    If(
    CountRows(Filter(colScannedBarcodes, Barcode = Result)) > 0,
    Notify("Duplicate barcode scanned.", NotificationType.Warning),
    Collect(colScannedBarcodes, {Barcode: Result})
    )
    );

     

    Can u try this modification

     

     

  • Nicci Profile Picture
    194 on at

    Its not result, that I know because I use forall for patching and the scanning value is called value, not result; result is not identified.

  • Nicci Profile Picture
    194 on at

    So it have no way to know if this is doing anything. I removed all code and just set the OnScan to the below and the notification message does not pop up when scanning stuff.

     

    Notify("Duplicate barcode scanned.", NotificationType.Warning)

     

     So not sure if 'OnScan' is what I think it is since when i scan a barcode I get no warning message (without any other code in there) which tells me its not triggering.

     

     

    Edit: the warning comes up after you click 'submit' and get out of scanning mode.

     

    That is not a good place for this trigger because I need users to know they accidentally scanned duplicate in live time. When they scan over 100 items they need to know a mistake was made right then and there to remove it from the list, when you click submit it's too late and since there was a duplicate they'll have to now go back and rescan everything again since you cant go back into scanning and continue, it clears out the scan collection each time you click the scan button.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard