cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CanD
Helper IV
Helper IV

Toggle change value to another value over other toggles and reset if not visible

Hello community,

 

i have a small question. I have 4 Toggles, each of them is standard on yes. I want to make all four dependent on each other. At the beginning you only see the first Toggle. If this is set to no, the second Toggle is displayed. If you set the second Toggle to no, then the third is displayed. And so on. If now Toggles 1-3 are no and I change the first Toggle back to yes, then Toggle two and three are automatically hidden again. Everything works out to this point, but here is my problem. Toggle two and three are still set to no. They should actually jump to their default value yes if the previous Toggle (in this case the first one) is set to yes.

How is it possible to set the default value if for example the first Toggle is set again to yes? We can use his own visible value, for example if he is not visible then set value to yes (only for exmaple maybe there is a smarter solution).

 

I hope someone can help me with this problem.

Thank you.

 

 

Best regards

CD

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

Here is a slightly different way to do it by making changes in three properties (Visible, Default and OnChange).

 

Toggle Control

Visible

Default

OnChange

Toggle1

true

true

Reset(Toggle2)

Toggle2

!Toggle1.Value

true

Reset(Toggle3)

Toggle3

!Toggle2.Value

true

Reset(Toggle4)

Toggle4

!Toggle3.Value

true

false



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
AndrewGibson1
Helper I
Helper I

Hi there,

I've just tried this and the following seems to work (and you can change the variable values to true or false depending on your needs). IN the following the variable I use is 'varA' but you can call this what you like.

On the first Toggle, set a variable on the 'OnChange' property.

If(Toggle1.Value=false, Set(varA,false));
If(Toggle1.Value=true, Set(varA,true));

 

Then on the secondary Toggles, set the 'Default' value to varA

 

You should be able to propagate this logic throughout your toggles to get the outcome you need.

Best of luck on your PowerApp journey!

Jeff_Thorpe
Super User
Super User

Here is a slightly different way to do it by making changes in three properties (Visible, Default and OnChange).

 

Toggle Control

Visible

Default

OnChange

Toggle1

true

true

Reset(Toggle2)

Toggle2

!Toggle1.Value

true

Reset(Toggle3)

Toggle3

!Toggle2.Value

true

Reset(Toggle4)

Toggle4

!Toggle3.Value

true

false



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
CanD
Helper IV
Helper IV

@Jeff_Thorpe    @AndrewGibson1  Thank you very much. I tried your solutions and it worked exactly the way i wanted it to 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,767)