cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Barcode OnScan function sometimes requiring two scans to log changes

Morning All,

 

Was wondering if I could possible get some assistance with the below. I'm currently working on a staff & visitor registration app, that sources it's barcodes and records from a SharePoint list. I'm about 90% there, but in testing i seem to be having an issue where after scanning the barcode, it doesn't run the functions as intended. The process should flow as follows:

 

1. The barcode scans, and sets the scanValue to the barcode string, and starts a timer to get the data and update the record:

Set(
scanValue,
StaffSignInScan.Value
)

 

2.  The gallery gets the item from the SP list where the barcode string matches the scanValue:

 

3 The timer then runs for 4 seconds, to allow for the data to be transferred from the list to app, then runs the following code:

 

Set(
StartSignInOut,
false
);
If(
UserScanForBarcode.Selected.'Signed Out?' = true,
Patch(
'Site Sign In',
UserScanForBarcode.Selected,
{'Signed Out?': false}
);
Notify(
UserScanForBarcode.Selected.Name & " has signed into " & SiteVar,
NotificationType.Success
);
Reset(StaffSignInScan);
Set(
scanValue,
StaffSignInScan.Value
);
Refresh('Site Sign In')
);
If(
UserScanForBarcode.Selected.'Signed Out?' = false,
Patch(
'Site Sign In',
UserScanForBarcode.Selected,
{'Signed Out?': true}
);
Notify(
UserScanForBarcode.Selected.Name & " has signed out of " & SiteVar,
NotificationType.Success
);
Reset(StaffSignInScan);
Set(
scanValue,
StaffSignInScan.Value
);
Refresh('Site Sign In')
);

 

This resets the timer, clears the gallery for the next use, and refreshes the data source to ensure there's no server conflicts afterwards. Or so I hoped.

 

The issue is that it will work for an indeterminate amount of scans, then sometimes fail to load or run the function of getting the data record of the scanned bar code. I was thinking whether moving the clear form should be moved to the start of the bar code scan, to force a record clear, but in most cases the record is almost empty, it just appears the scan isn't working.

 

Any advice would be appreciated, thanks.

1 REPLY 1
Highlighted
Helper II
Helper II

Hi mate,

 

Might be worthwhile to add a check to see if the barcode scan value is blank. That would rule out the issue of it trying to "search" for a record with a blank value.

Just use the If(IsBlank(barcodeScanner.Value), "Problem scanning barcode", **DO barcode stuff here**)

 

Regards,

Jacob Shand | Automation Specialist

NextStep Creations


Taking your PowerApps Skill the NextStep

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,398)