cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vsslasd
Advocate V
Advocate V

OnSelct Barcode Scanner Property

The Barcode Scanner doesn't have an OnSelect property. 

 

Question: In a canvas app, we want the "Default" Value to read from a collection, allowing the user to utilize the barcode scanner to write over that value which is stored in the collection with the Barcode Scanner Value. 

 

The BarcodeScanner.Value does a nice job of pulling data from the barcode scanner, but we would like to push data into the text box control from the scanner e.g. using the OnSelect. 

 

How do we still display the existing value from the collection in the textbox control, while enabling the scanner to overwrite the value in the collection if the scanner button is clicked ? 

 

 

4 ACCEPTED SOLUTIONS

Accepted Solutions
cwebb365
Power Participant
Power Participant

I do it this way. 

In the default proprety of the textbox I use this:

If(IsBlank(ScannedNew),FIIX_x0020_ID,ScannedNew)

 

Then next to the textbox is a camera icon with onSelect: Set(ScannedNew,ScanBarcode())

 

This basically says, if that variable is blank then show existing value, otherwise, overwrite it with the scanned barcode item. 

View solution in original post

mobaky
Power Apps
Power Apps

Hello @vsslasd,

 

Thanks for your questions, We've actually just implemented a new  "OnScan" property that might help with this scenario and it will be very similar to the onChange property in other controls. This should be available by the end of january.

 

Studio:

Inkedonscan barcode_LI.jpg

 

Mobile Player:

barcodescanner.jpg

 

View solution in original post

cwebb365
Power Participant
Power Participant

For what you are trying to do it should work fine, it works on my app no problem. So what isn't working when you use this? Does it error, is it not showing anything? It should show the value, then after a scan, should overwrite or technically "use" the scanner value when it isn't blank. 

View solution in original post

Thank you, I think it's working now. It seems like intermittently it doesn't but I will keep testing. 

 

View solution in original post

17 REPLIES 17
cwebb365
Power Participant
Power Participant

I do it this way. 

In the default proprety of the textbox I use this:

If(IsBlank(ScannedNew),FIIX_x0020_ID,ScannedNew)

 

Then next to the textbox is a camera icon with onSelect: Set(ScannedNew,ScanBarcode())

 

This basically says, if that variable is blank then show existing value, otherwise, overwrite it with the scanned barcode item. 

View solution in original post

mobaky
Power Apps
Power Apps

Hello @vsslasd,

 

Thanks for your questions, We've actually just implemented a new  "OnScan" property that might help with this scenario and it will be very similar to the onChange property in other controls. This should be available by the end of january.

 

Studio:

Inkedonscan barcode_LI.jpg

 

Mobile Player:

barcodescanner.jpg

 

View solution in original post

Thank you!

I've tried using your formula, but something is not correct. 

is it possible you can clarify ? I have a red underline under: Set(ScannedNew,ScanBarcode()).

Something is missing. 

Thank you very much.

PS - this is a canvas app. 

The solution that  @cwebb365 suggested is using the barcode function but you will have to enable it from the experimental features settings.  

Text Input (Default):

marcode 1.PNG

 

 

Button (OnSelect):

 

 

barcode2.PNG

 

 

Note that this feature will be deprecated soon but not before the property is available 🙂 

Thank you. We are trying to avoid experimental features, though. 

This is confusing, though, because this article: https://powerapps.microsoft.com/en-us/blog/new-barcode-scanner-control/

states: " Finally, this is not an experiemental control but one we feel is worthy for use in production...."

Evidently, it still is "experiemental" ?

Thank you for clarifying.

Oh no what I meant is that the scanBarcode function that is used in @cwebb365 's  proposed workaround is experimental and will be deprecated soon but it could temporarily unblock you until the new property is released.

 

But the new Barcode scanner control is not an experimental 🙂   

cwebb365
Power Participant
Power Participant

Ok, so I just updated my App to the new control from the old way which I linked. 

 

It's still basically the same, but you do it like this. 

For the Textbox you want to update, you add a Barcode control next to it, in this case BarcodeScanner2, then in the default of the Textbox use: If(IsBlank(BarcodeScanner2.Value),FIIX_x0020_ID(Your collection field),BarcodeScanner2.Value)

 

This should show your collection field by default until there is a value in the barcodescanner2 which means you clicked to scan in a number, scan, then it will populate the field. Then you have a button to commit those changes. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,700)