cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Update or reset component variables by opening screen

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Update or reset component variables by opening screen

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 Support Team _ Kris Dai
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

4 REPLIES 4
Dual Super User
Dual Super User

Re: Update or reset component variables by opening screen

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

Highlighted
Anonymous
Not applicable

Re: Update or reset component variables by opening screen

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.

 

Community Support Team
Community Support Team

Re: Update or reset component variables by opening screen

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 Support Team _ Kris Dai
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

Anonymous
Not applicable

Re: Update or reset component variables by opening screen

Hi @v-xida-msft ,

 

thank you for your response.

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

 

Thanks!

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,974)