I need power apps to realize a function, scan the barcode to get a string of numbers, and then go to the list to query the corresponding area of this string of numbers, displayed in the label, but I found a problem, when I did not close the application and scan the barcode again, jump to the window displaying the label, I will find that there is the area of the last scanning label, and the correct area will be displayed only after two or three seconds, I have thought of trying to reset the label's text in the back button, but did not succeed, is there any other way to do it please?
The first step is to scan the code and jump to another window
Reaching the next window, I have a form whose Item has been set to the item corresponding to the number that came out of the code scanning
In this forms, there is a label that displays the corresponding area, and a button to return to the home page. there is no problem with the label displaying the area, but after returning to the home page and scanning the code again, I found that the label displays the previous area, and it takes a few seconds to display the correct area.
I wanted to try to reset the label's text to null on return, but found no way to do it, so I had to come here to ask, thanks!
Thanks, your answer is fine, I made a mistake yesterday.
Hi @poweractivate ,I tried it according to your variable method, but I found that this variable works when I'm in the scanning window, but after jumping to the second window, this variable varScannedNumber doesn't work, for example, I tested it again and there's a label with the text of varScannedNumber, but at runtime, nothing is displayed for this lable。thanks
Hmm, try this and see if it may work, try changing the Items property of Form2 especially to the below:
Set a Context Variable for the Scanned Value: On the screen where you scan the barcode, set a context variable when the barcode is scanned:
UpdateContext({varScannedNumber: First(BarcodeReader1.Barcodes).Value})
Update the Item Property of Form2: Change the Item
property of Form2
to use this context variable:
First(Filter('area number', number = varScannedNumber))
Clear the Context Variable When Navigating Away: When you click the button to return to the home page or navigate to another screen, clear the context variable
UpdateContext({varScannedNumber: ""}); Navigate(YourHomeScreen, ScreenTransition.None)
(and do this instead of even resetting the form. Guess you could try it with resetting the form too, which if you try it would be right after UpdateContext, right before Navigate).
See if it helps @dongdong
@poweractivate Hi,I've tried this before, to no avail, and I'm not sure why.
WarrenBelz
48
Most Valuable Professional
mmbr1606
41
Super User 2025 Season 1
MS.Ragavendar
36