cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RoScha
Helper V
Helper V

Count how many toggle buttons are on yes

Hello community,

this time I have the following topic:

 

On the screen below you will see a Form with toggle buttons.

RoScha_0-1607505620014.png

If the toggle buttons have been set to "yes", I would like to count them straight away, in the blue label. Because I want to control the visibility of the save button with it.

 

Means: if no toggle button was set to "yes", the blue label shows "zero" and if a toggle button is set to "yes", this must then happen as a formula: 0 = 0 + 1 or X=X+1

If the toggle button is set from "yes" to "no", the formula is of course X = X-1 until "ZERO" is reached again at some point.

I hope you understand what I mean.


Now the exciting question is: how do I get that?

 

Thank you for your help.

 

Best regards

RoScha

1 ACCEPTED SOLUTION

Accepted Solutions
GarethPrisk
Resident Rockstar
Resident Rockstar

You can easily count True toggles, since it produces a False (0) or True (1) value. PowerApps is able to use both the boolean/integer value, contextually.

Set your Blue label (for counting):

Sum(
    Toggle1.Value,
    Toggle2.Value,
    Toggle3.Value,
    Toggle4.Value
)

It may require some fine-tuning since you're using a Form, and the Toggles may produce a non-standard value (depending on their source), but this should work.

 

You mention this may be simply to control the visibility of a Save button. You don't need the count/label above, unless you want to show that to users. Instead, set the Visible property of your Save button to

Or(
    Toggle1.Value,
    Toggle2.Value,
    Toggle1.Value,
    Toggle2.Value
)

This will make it visible, if any Toggle is true.

View solution in original post

2 REPLIES 2
GarethPrisk
Resident Rockstar
Resident Rockstar

You can easily count True toggles, since it produces a False (0) or True (1) value. PowerApps is able to use both the boolean/integer value, contextually.

Set your Blue label (for counting):

Sum(
    Toggle1.Value,
    Toggle2.Value,
    Toggle3.Value,
    Toggle4.Value
)

It may require some fine-tuning since you're using a Form, and the Toggles may produce a non-standard value (depending on their source), but this should work.

 

You mention this may be simply to control the visibility of a Save button. You don't need the count/label above, unless you want to show that to users. Instead, set the Visible property of your Save button to

Or(
    Toggle1.Value,
    Toggle2.Value,
    Toggle1.Value,
    Toggle2.Value
)

This will make it visible, if any Toggle is true.

View solution in original post

Hello @GarethPrisk 

I am always amazed at how easy it is to make solutions and how I once again thought too complicated.

Many thanks.

 

Best regards

RoScha

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,475)