Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
  • Nicci Profile Picture
    194 on at
    Re: Barcode Scanning and Duplicates

    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.

  • Nicci Profile Picture
    194 on at
    Re: Barcode Scanning and Duplicates

    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.

  • mmbr1606 Profile Picture
    11,950 Super User 2025 Season 1 on at
    Re: Barcode Scanning and Duplicates

    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
    Re: Barcode Scanning and Duplicates

    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
    11,950 Super User 2025 Season 1 on at
    Re: Barcode Scanning and Duplicates

    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
    Re: Barcode Scanning and Duplicates

    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
    11,950 Super User 2025 Season 1 on at
    Re: Barcode Scanning and Duplicates

    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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,522 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,890 Most Valuable Professional

Leaderboard