Skip to main content

Notifications

Community site session details

Community site session details

Session Id : XcKdTbmKHd8BywCnT2RyHU
Power Apps - Building Power Apps
Answered

Reset the text of the label to empty

Like (1) ShareShare
ReportReport
Posted on 23 Aug 2023 04:16:54 by 81

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

dongdong_0-1692763641445.png

 

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

dongdong_1-1692763742239.png

 

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.

dongdong_2-1692764033377.png

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!

 

 

Categories:
  • dongdong Profile Picture
    81 on 24 Aug 2023 at 02:04:44
    Re: Reset the text of the label to empty

    Thanks, your answer is fine, I made a mistake yesterday.

  • dongdong Profile Picture
    81 on 23 Aug 2023 at 05:39:36
    Re: Reset the text of the label to empty

    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

  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on 23 Aug 2023 at 05:06:05
    Re: Reset the text of the label to empty

    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 

  • dongdong Profile Picture
    81 on 23 Aug 2023 at 04:59:36
    Re: Reset the text of the label to empty

    @poweractivate Hi,I've tried this before, to no avail, and I'm not sure why.

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on 23 Aug 2023 at 04:21:56
    Re: Reset the text of the label to empty

    @dongdong 
    Try to ResetForm and see if it helps.
    In a formula immediately before you navigate back to the home screen, ResetForm on Form2 right before.
    For example, like this below:

    ResetForm(Form2); Navigate(YourFirstScreenWithArea, ScreenTransition.None)

    See if it helps @dongdong 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 48 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 36

Overall leaderboard
Loading started