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!
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.
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.
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
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})
)
);
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
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.
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
WarrenBelz
146,522
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,890
Most Valuable Professional