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?
Solved! Go to Solution.
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.
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.
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.
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)
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
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
208 | |
187 | |
82 | |
56 | |
36 |
User | Count |
---|---|
287 | |
244 | |
119 | |
80 | |
55 |