cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bwaller
Regular Visitor

Barcode scanner add text to search box onscan

Hi - very new to powerapps so please bare with me!

powerapps has created an app for me based on an excel table. The search bar it automatically created seems to be controlled by the gallery code in items - sortbycolumms(search((@table), textsearchbox1.text, “column1”, “column2”, “column3”), “column1”, if(sortdescending1, descending, ascending))

I want to add a barcode scanner which will simply add the value from the scan into the textsearchbox1 on scan. I still want to keep the gallery populated as it is when the textsearchbox1 is empty. Anyone have any ideas, I’ve tried everything I can think of. Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @Bwaller ,

On the OnScan of the barcode scanner, set a Variable

UpdateContext({varScan:Self.Value});
Reset(TextSearchBox1)

Then the Default of TextSearchBox1

If(
   !IsBlank(varScan),
   varScan,
   Blank()
)

You might also put at Screen OnVisible

UpdateContext({varScan:Blank()});

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Hi @Bwaller ,

On the OnScan of the barcode scanner, set a Variable

UpdateContext({varScan:Self.Value});
Reset(TextSearchBox1)

Then the Default of TextSearchBox1

If(
   !IsBlank(varScan),
   varScan,
   Blank()
)

You might also put at Screen OnVisible

UpdateContext({varScan:Blank()});

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Hi @WarrenBelz  - Thanks for your reply!!

it’s coming up with two errors, one for the scanner which says “the first argument of the ‘updatecontext’ should be a record” and the second on the search bar says “invalid argument type. Cannot use _Min values in this context.”

Do you know what these mean? unfortunately it doesn’t enter the data from the scanner into the search bar still. Any help still appreciated.

Hi @Bwaller ,

The first piece

UpdateContext({varScan:Self.Value})

on the OnScan of a barcode scanner is valid as I use it myself (and just re-tested it), so I am not sure why you are getting an error. Did you copy this exactly as above on the right property?

There is nothing about _Min values (I don't even know what this is) in any of the code.

Can you please re-check my post and make sure you followed the process - there is nothing in there that should produce any errors.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz  - I re-checked the code and it was copied correctly. I deleted all the code in the whole app and re-added it, it all now works perfectly - really appreciate the help!!!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,354)