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
Solved! Go to Solution.
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.
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.
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))
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
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.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
199 | |
71 | |
50 | |
43 | |
30 |
User | Count |
---|---|
259 | |
124 | |
90 | |
86 | |
85 |