cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User
Super User

Re: using multiple toggles

@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.

View solution in original post

15 REPLIES 15
Highlighted
Super User
Super User

Re: using multiple toggles

Hi @morall 

make the default of Toggle2: !Toggle1.Value

Highlighted
Super User
Super User

Re: using multiple toggles

@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.
Highlighted
Microsoft
Microsoft

Re: using multiple toggles

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)

Highlighted
Super User
Super User

Re: using multiple toggles

@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.
Highlighted
Microsoft
Microsoft

Re: using multiple toggles

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

Highlighted
Super User
Super User

Re: using multiple toggles

wrong.gif

Highlighted
Super User
Super User

Re: using multiple toggles

@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.
Highlighted
Super User
Super User

Re: using multiple toggles

@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.
Highlighted
Microsoft
Microsoft

Re: using multiple toggles

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,260)