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

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

8 REPLIES 8
Jeff_Thorpe
Super User
Super User

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

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 

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.

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 

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.

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

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 

thank you

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

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.

Users online (1,396)