web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using an EXTERNAL bar ...
Power Apps
Answered

Using an EXTERNAL bar code reader WITHOUT requiring the keyboard

(0) ShareShare
ReportReport
Posted on by 54

I am writing a simple inventory tracking program. I want to be able to have people scan items with an external reader and without needing any keyboard entry.

 

I'd like to be able to use a separate barcode reader to read a barcode and beep or buzz depending on the results of that as well as display an optional on-screen entry.

 

From my reading, I can't capture the return key and do anything useful like trigger the default button, I also tried setting the suffix to a tab key and have it's onselect action do a lookup and return the focus to the initial field. Neither method seems to work.

 

Is there any way to get this to work in PowerApps? Again, I want to repeatedly process barcode input without needing to push a button or do anything else. I want to use an external reader and NOT the builtin mobile control.

Categories:
I have the same question (0)
  • ThatAPIGuy Profile Picture
    925 on at

    can you give more details / screenshots of what you are trying to achieve.

     

    How is this external reader sending the details to powerapps?

     

    What exactly do you want to see on the powerapps screen?

  • ralphtrickey Profile Picture
    54 on at

    The bar code reader we're using has an optional Prefix and Suffix you can send. It functions as normal keyboard input. My initial thought was that it would send through the data into a field on the screen followed by the enter key which would trigger the default button to do a lookup and a refresh of the screen. My second thought was to use the enter event of the following field to cause this to happen.

     

    Here's a rough mockup of what I'd like to do. The workflow is to first scan the room tag then scan the inventory tags inside the room, then scan the room tag again to indicate it's finished.

     

    SCREEN MOCKUP

    <Place for bar code input> <optional second field if needed>

     

    Room # 53

    Status                   Item

    Scanned Today    Laptop

    Not Scanned        Monitor

    Other Status         Other Items

     

    <Button for done with room>

     

    Thanks,

    Ralph

     

  • ThatAPIGuy Profile Picture
    925 on at

    Ok, I think I understand your issue now.

     

    Instead of a tab or enter , you could use a suffix say the character "k" and then check if the input has k in the end and then automatically trigger the lookup

     

    Let's take a sample case-

     

    scan a barcode 

    TextInput will be - 0123456k

     

    I am assuming you will show the lookup values in a gallery.

    So , you can set the Gallery's Items property to If(Right(TextInput1.Text,1)="k",LookUp(BarCodeDataSource,Barcodenumber=First(Split(TextInput1.Text,"k")).Result))

     

    If you have a consistent leght of barcode(number of charaters) , you could use that as well by checking for the length of text input

    There is no way to take the focus back to textinput control. However, this way you dont have to click a button for it to lookup.

     

    I probably haven't answer all your questions here, but i hope this helps

  • ralphtrickey Profile Picture
    54 on at

    Thanks! I hadn't thought of using a different terminator that way, that definitely sounds like a start. Now, instead of displaying that record, I need to update its LastScannedDate and LastScannedBy fields with the data for that entry and clear the field to allow for another input. Can I use the UpdateIf function to update it? If I do that, how do I clear the text field afterwards? The suggestions I saw for clearing a text field seem to introduce a race condition.

  • Verified answer
    ThatAPIGuy Profile Picture
    925 on at

    @ralphtrickey

     

    Put this on the OnChange property of the text input - 

    If(Right(TextInput1.Text,1)="k",Patch(BarCodeDataSource,First(Filter(BarCodedataSource,Barcodenumber=First(Split(TextInput1.Text,"k")).Result)),{LastScannedDate:Today(),LastScannedBy:User().Email}))

    Using the patch function , you can update the record where the bar code number matches the one in that column.

     

    Set the reset property of Text input to textinputreset and then you can reset the input by adding this code (see towards the end) to the OnChange property of text input itself.

    If(Right(TextInput1.Text,1)="k",Patch(BarCodeDataSource,First(Filter(BarCodedataSource,Barcodenumber=First(Split(TextInput1.Text,"k")).Result)),{LastScannedDate:Today(),LastScannedBy:User().Email})); UpdateContext({textinputreset:true};UpdateContext({textinputreset:false})

     

  • ralphtrickey Profile Picture
    54 on at

    Awesome, thanks. I'm pretty sure that's all I need for now. I've played with declarative languages but I'm finding it a bit hard to meld the imperative actions like Patch with the declarative actions like clearing a text field. I think this is the only place I need to use this particular construct though.

     

  • ThatAPIGuy Profile Picture
    925 on at

    @ralphtrickey

     

    I am not a software engineer/programmer, so probably can't understand your dilemma very well.

     

    As you needed more automation in this case, we had to combine these actions. I have used it a lot of times for my apps as well, where I need to reset some text input control, dropwdown controls, toggles, etc. when I click on submit button to either patch records , send emails, etc.

     

    Anyways, hope it worked out for you. Let me know if you have any further questions.

     

    Thanks

  • ralphtrickey Profile Picture
    54 on at

    Sadly, I must be doing something wrong still. Textinputreset is in reset. The onchange should clear the textbox. I put the updatecontext code in the onvisible part of the screen which should clear the field when the form is entered. Nothing is happening.

     

    I'm using the web editor.

     

    Any suggestions?

     

    Thanks,

    Ralph

     

    Capture.PNG

     

    If(Right(TextInput1.Text,1)="k",UpdateContext({textinputreset:true};{textinputreset:false}));
    UpdateContext(
    {textinputreset:true};
    {textinputreset:false})

     

  • ThatAPIGuy Profile Picture
    925 on at

    It should be two separate UpdateContext. Try this and let me know if it doesn't work

    UpdateContext({textinputreset:true};UpdateContext({textinputreset:false}
    If(Right(TextInput1.Text,1)="k",UpdateContext({textinputreset:true});UpdateContext({textinputreset:false}))

     

  • ThatAPIGuy Profile Picture
    925 on at

    I just checked on my side and its not working. let me figure it out and I will let you know soon.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard