cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Scan and Record Multiple Barcodes

Hi,

 

I'm creating an app where I would like to scan and record multiple barcodes. I need to be able to exit the barcode scanner in between scans as the barcodes won't necessarily be scanned continuously. Basically I need to scan a barcode, record to multiline text input then have the ability to scan additonal barcodes and have them record to the same multiline text input. 

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
jhall
Continued Contributor
Continued Contributor

Pretty straightforward and I just tested to verify.  Drop your scanner button onto your app and change the OnScan code to be similar to the following:

Set(gScanData,gScanData & Char(10) & BarcodeScanner1.Value)

You can optionally drop in an If() to check if gScanData is empty so you don't get a Line Break at the beginning of course.

Then add a MultiLine Text field and set the Default to be gScanData.

 

View solution in original post

5 REPLIES 5
jhall
Continued Contributor
Continued Contributor

Pretty straightforward and I just tested to verify.  Drop your scanner button onto your app and change the OnScan code to be similar to the following:

Set(gScanData,gScanData & Char(10) & BarcodeScanner1.Value)

You can optionally drop in an If() to check if gScanData is empty so you don't get a Line Break at the beginning of course.

Then add a MultiLine Text field and set the Default to be gScanData.

 

Anonymous
Not applicable

This works but since the first one variable is blank, I get a blank line first and then each barcode. Is there a way to remove that?

Probably along the lines of modifying it to use IsEmpty or IsBlank on gScanValue before the assignment.  Similar to:

If(!IsEmpty(gScanValue),Set(gScanData, BarcodeScanner1.Value),Set(gScanData,gScanData & Char(10) & BarcodeScanner1.Value))

 

abauman
Regular Visitor

I used this code and it works perfectly for scanning the barcodes, I have run into an issue though.

 

I am using the barcode scanner in an app that is used to keep a record of inventory transfers in a warehouse. I will attach a screenshot of the app so you can get an idea of how it is set up.

 

The only problem I am having is when the form is submitted and a new form is loaded the user tries to scan new barcodes and

the data from the previous scans are populating in my text field, along with the new ones. Wondering if you have had this issue or have a solution to my problem.

 

Thanks

 SystemTransfers Powerapps.png

Most likely is needing to clear your Form via either the ResetForm() command, or the Reset() command on an individual control, or set a Boolean and assign it to the Reset attribute for the individual controls involved and swap that Boolean from False/True (you have to make sure you change the value or it will not reset - just having it True won't work).  

 

Depending upon your application design, one (or more) of those will work.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,032)