cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ralphtrickey
Helper I
Helper I

Using an EXTERNAL bar code reader WITHOUT requiring the keyboard

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.

1 ACCEPTED SOLUTION

Accepted Solutions

@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})

 


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

16 REPLIES 16

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?


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

 

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


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

@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})

 


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

 

@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


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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})

 

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}))

 


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,006)