cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Count unselected radio buttons

Is there a way to count the amount of radio buttons unchecked in powerapps. In my gallery I have a radio button and there are about 50 buttons in gallery. I want to make sure the user hits all of them so when the radiobutton is checked I want a text label to decrease by one. Is this possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Count unselected radio buttons

You could create a variable and set it to 0 in the screens OnVisible property then in the Radio OnChange property increase that variable by 1. Then you could use the variable in your label to display how many buttons have been click. 

 

Screen > OnVisible > Set(varRadioButtonSelectedCounter, 0)

Radio Control > OnChange >Set(varRadioButtonSelectedCounter, varRadioButtonSelectedCounter + 1)

 

If  you wanted to count backwards then you would initially set the variable to the starting number and then in the OnChange you would decrease the variable by one.



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

7 REPLIES 7
Highlighted
Super User II
Super User II

Re: Count unselected radio buttons

You could create a variable and set it to 0 in the screens OnVisible property then in the Radio OnChange property increase that variable by 1. Then you could use the variable in your label to display how many buttons have been click. 

 

Screen > OnVisible > Set(varRadioButtonSelectedCounter, 0)

Radio Control > OnChange >Set(varRadioButtonSelectedCounter, varRadioButtonSelectedCounter + 1)

 

If  you wanted to count backwards then you would initially set the variable to the starting number and then in the OnChange you would decrease the variable by one.



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

Highlighted
Post Prodigy
Post Prodigy

Re: Count unselected radio buttons

I noticed an error with this.. The problem is that when the person loads the app back up there will already be radio buttons selected. However the countdown number is still at 50. How can I get the number to stick when they reload the app? @Jeff_Thorpe 

Highlighted
Super User II
Super User II

Re: Count unselected radio buttons

Will all the all radio buttons be selected when the user loads it back up. If so, you can add some logic to the Visible to set the count variable depending on if this a new item or an existing item. Otherwise you will need to check every radio control to see if it is checked and adjust the count accordingly in the OnVisible property.



--------------------------------------------------------------------------------
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.
Highlighted
Post Prodigy
Post Prodigy

Re: Count unselected radio buttons

No when it is loaded back up not every button will be checked. So how do I implement this? In the label do I do something like If(Radio4.Selected, varRadioButtonSelectedCounter - 1) @Jeff_Thorpe 

Highlighted
Super User II
Super User II

Re: Count unselected radio buttons

If you are setting the starting variable in the OnVisible then update it to something like this:

Set(varRadioButtonSelectedCounter, 50);
If(Radio1.Selected, varRadioButtonSelectedCounter - 1);
If(Radio2.Selected, varRadioButtonSelectedCounter - 1);
If(Radio3.Selected, varRadioButtonSelectedCounter - 1);
--- rinse and repeat for all the radio buttons ---------
If(Radio50.Selected, varRadioButtonSelectedCounter - 1)

 



--------------------------------------------------------------------------------
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.
Highlighted
Post Prodigy
Post Prodigy

Re: Count unselected radio buttons

I only have one radio button it is in the gallery @Jeff_Thorpe 

Highlighted
Post Prodigy
Post Prodigy

Re: Count unselected radio buttons

I have a datasource that stores the persons submission to pull it back in called GUATResponses. I was thinking I could do something like counting them in the data source by email. Because with what you posted it will say 50 every time when the person opens the app even if they already have some selected from the previous submission @Jeff_Thorpe 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,150)