cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
morall
Microsoft
Microsoft

using multiple toggles

I have 3 toggles

 

Toggle1

Togge2

Toggle3

 

I want to be able to move toggle2 & toggle3 to false every time I "oncheck" toggle1.

 

I currently have

Toggle1 OnCheck to Set(Toggle2, false)

 

And toggle2 default is set to Toggle2

 

It works the first time, but if I randomly flip the toggles around, it stops working. 

 

How do I write it so that it will always flip Toggle2 back to false every time I toggle1 to true. 

1 ACCEPTED SOLUTION

Accepted Solutions

@morall 

You know...the first thought that comes to mind is hmmm, that's a little over complicating a simple situation.  Reason...because the Radio control would be a much better pick for this situation.

 

Have you considered that instead?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

15 REPLIES 15
Drrickryp
Super User II
Super User II

Hi @morall 

make the default of Toggle2: !Toggle1.Value

RandyHayes
Super User III
Super User III

@morall 

Consider setting the Default property of Toggle2 and Toggle3 to false.

Then set the Reset property of Toggle2 and Toggle3 to Toggle1.Value

 

You can get rid of the OnCheck actions and variables.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

I was trying to learn more about what the reset property did, but the documentation didn't say that much. Can you give a laymen explanation? (ie - a sentence or two)

@morall 

Reset is a true/false value that tells the control to reset to default.

 

In your scenario, you are setting the Reset to the value of the Toggle1.  Therefore, when you set Toggle1 On/true.  The other Toggles will then Reset.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Ok, I see what it does, however I have created circular logic.

 

I'm getting an error when I do this

 

reset Value of Toggle1: Toggle2.Value

reset Value of Toggle2: Toggle1.Value

 

I'd like to make it so that when:

 

This is why I was thinking of doing OnCheck, make the value of every other toggle false

 

Toggle1 is Yes

toggle2 & Toggle3 are set to No

 

When Toggle2 is Yes

Toggle1&Toggle3 are set to No

 

..etc

wrong.gif

@morall 

You do not set the Reset of Toggle1 only Toggle2 and Toggle3

Your original requirement was that if Toggle1 was turned on, you wanted all the others to go false.

 

Are you stating your requirement is different?

 

Yes, if you do what you were trying there, you will have circular logic...not allowed!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

@Drrickryp 

FAVORITE!!!!!!!!!!!!!  😀

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Yes. Solving it the way you recommended worked, but then I realized it didn't solve the full problem

 

For example filtering a list of people in a Gallery:

 

Toggle1: Filter list of people with "interest"

Toggle2: Filter list of people "without interest"

 

I don't want to let users be able to toggle both to be true. I would like it so that Toggle1 will always turn off Toggle2 and vice versa. However, they can both be off and users can see everyone.

 

I saw someone else trying to do the same thing with UpdateContext() but I couldn't get it to work. 

 

Any thoughts? 

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (44,053)