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 / Update or reset compon...
Power Apps
Answered

Update or reset component variables by opening screen

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi there,

 

I've created an app with multiple screens. Each screen has a menu that can be opened via a component. The menu is created via the solution as mentioned in  Components - Screen Navigation .

 

Clicking on the component opens the menu. Adding the same component to multiple screens means that every component gets a different name.  The menu's visible property for screen 8 is set to:

If(Q08MenuFooter.MenuGlobal = "Menu" , true, false)

The point is that the variable that is being updated for screen 8 applies to all screens. So the menu appears on every screen. As a result, the user must first switch it off again.

Is it possible to update or reset the variable that is created / set in a component when opening a screen?

 

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @Anonymous 

     

    If you add a property to the component itself that sets the menu to be hidden, then each component element added to each screen can set the property specific to the screen 

     

    Regards,

    Reza Dorrani

     

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

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @RezaDorrani ,

     

    thank you for your answer.

    I'm not sure if I understand it correctly.

     

    In the app people can open a menu screen (gallery) with all 16 items (screens). These items navigates the person to the selected screen. So far so good.

    For example, when the person has screen Q07 open and navigates via the menu to screen Q04 all is fine. When he navigates back to screen Q07, the menu is still open and it's not very clear for the person that he reached Q07.
    Via a few icons in a component and an output property he can activate and deactivate this menu. Selecting the menu icon sets a global variable via the output property to "Menu". Select another icon sets the same variable to "Edit." 

     

    So what I want is that when the screen gets visible the variable automatically is set to Edit. For example via the onVisible control.

    Thing is that a variable set by a component is not editable outside the component.

     

    Can you give me some more advice?

    Thanks in advance.

     

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you initialize your variable within your Component control?

    Do you want to set the variable value outside the Component control?

     

    Based on the needs that you mentioned, I think the OnRest property of the Component control could achieve your needs.

    I have made a test on my side, please take a try with the following workaround:5.JPG

     

    6.JPG

    Please set the OnReset property of your Component control (Component1) to following:

    Set(yourGlobalVar, "Edit")

    Then within your screen, set the OnVisbile property to following:

    Reset(Component1)

    Please consider take a try with above solution, then check if the issue is solved.

     

    Also please check if the following article would help in your scenario:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/component-behavior

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-xida-msft ,

     

    thank you for your response.

    The reset function in combination with the onvisible property did the trick.

     

    Thanks!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard