cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jdhough55
Helper II
Helper II

Checkbox troubles

Hi there, 

I have 4 checkboxes (out of a gallery etc) and a select all button. 

 

jdhough55_0-1656527703219.png

if all are checked (with select all) and then i remove one tick , I want to be able to re-tick them all again with the Select All button. 

I know i am nearly there but i just cannot seem to get the last issue i am having. 

 

So Select All, on the OnCheck, i set some variables : 

 

UpdateContext({AllChecked: true});
UpdateContext({AllUnChecked: false});

 

on the default value of each checkbox besides the select all . I have this formula to set the value : 

 

If(
    AllUnChecked,
    false,
    gblInspectionItemTPHVehicle.MOT = 'Yes or No'.Yes || AllChecked,
    true
)

So if Allunchecked is false, it goes to the collection (all results are stored in a collection) on a save button. It checks if the checkbox in the collection is Yes OR the value of AllChecked -then true

 

So for example a test is : 

 

1. Navigate to screen
2. Press Select All - All checkboxes are selected
3. Unselect some checkboxes
4  Press Select All - All checkboxes should be selected, but they are not

 

I reset all chx boxs onHidden on the page , so it will load it back up from the collection . I really am in need of urgent help on this issue, if anyone could help - brilliant 🙂

Happy to provide much more information as we go. 

 

Cheers 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
One
Super User
Super User

hi @jdhough55 ,

you need to reupdate your variables back to false or true after it has checked all the checkboxes. I have linked an article that discusses a similar topic Here. Feel free to let me know if you're still having trouble and I can try to walk you through it. 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

View solution in original post

2 REPLIES 2
One
Super User
Super User

hi @jdhough55 ,

you need to reupdate your variables back to false or true after it has checked all the checkboxes. I have linked an article that discusses a similar topic Here. Feel free to let me know if you're still having trouble and I can try to walk you through it. 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

TheRobRush
Super User
Super User

Just posted this a week or so ago to someone with question, copy pasted my old response below

 

Ok check it out

I have 6 check boxes

Checkbox2 is the check all

then 2_1-5 are the individuals

Checkbox2 default is 

If(
And(
Checkbox2_1.Value=true,
Checkbox2_2.Value=true,
Checkbox2_3.Value=true,
Checkbox2_4.Value=true,
Checkbox2_5.Value=true),
true,
false)

Checkbox 2 OnUncheck is

Set(checkallVar,false)

Checkbox2 OnCheck is

Set(checkallVar,true)

 

Both the oncheck and onuncheck of all 5 indivial check boxes will be 

Reset(Checkbox2)

and their default will be 

If(checkallVar=true,true,false)

 

with this checking checkall box wil check all, or uncheck all if unchecked, and when all are checked this box appears checked, while unchecking any box unchecks it. checking all boxes individually willl also check this box 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,139)