web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Oncheck of checkbox ma...
Power Apps
Unanswered

Oncheck of checkbox mark other checkbox as checked - updatecontext

(0) ShareShare
ReportReport
Posted on by 32

Hi, 

 

I have 5 checkboxes (Metro, Regional, Remote, Select All, N/A). I have my app set so that clicking "N/A" resets the other 4 checkboxes to unchecked. 

 

I'm trying to find a way so that clicking "Select All" sets the three (Metro, Regional & Remote) to checked.

 

I think this can be done with an updatecontext variable e.g. 

Select All - OnCheck - UpdateContext({CheckboxVar1:true})

 

But I don't know how to update the default of the three (Metro, Regional & Remote) checkboxes to = CheckboxVar1, so they update to checked when the context variable is updated to true.

 

I've tried the following but get an error:

  • CheckboxVar1
  • "CheckboxVar1"
  • CheckboxVar1.Value

RubySmith11_0-1627542305908.png

 

Any assistance appreciated! 

Thanks,

Ruby

Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    a2.jpg

    Let's say you have 5 checkboxes and 1 select all check box. You only want 3 of them to get selected when select all check box is checked.

     

    Select All check box name: CheckBox1

    Set Default of those 3 check boxes as CheckBox1.Value

    This whatever value of select all, will be applied to those 3.

  • RubySmith11 Profile Picture
    32 on at

    Hi @zmansuri ,

     

    Thanks for your reply! My setup and ideal functionality is this:

    • oncheck of A, B & C patches true to values in a collection
    • onuncheck of A, B & C patches false to values in a collection. Also Reset the SelectAll checkbox (to unchecked) in case it was checked as if at least one of A, B and C no longer checked then SelectAll cannot be checked either - this is where I am getting an issue now
    • oncheck of SelectAll marks checkbox A, B & C as checked and patches true to the collection for all three
    • onuncheck of SelectAll marks checkbox A, B & C as unchecked and patches false to the collection for all three 

    I tried your solution and it works for the select all: A, B & C patch as true and mark checkboxes as checked. 

     

    However, if I Uncheck "A" for example, all boxes (A, B, C and SelectAll) visually become unchecked but the patched data still has "true" for B & C. 

     

    Screenshots below, hopefully that will make a but more sense!

     

    Hoping for a solution that if I select "All", then uncheck "A", I still want "B" and "C" to be checked and patch true. 

     

    Alternatively, if this cannot be done I need "B" and "C" to patch false so that the screen matches the data patched.

     

    Setup:

    RubySmith11_0-1627612583813.png

    Checkbox names are: 

    • CheckboxAll
    • CheckboxA
    • CheckboxB
    • CheckboxC

    Button: OnSelect: ClearCollect(testCollection, {ID:1, A:false, B:false, C:false},{ID:2, A:false, B:false, C:false})

     

    CheckboxAll:

    • OnCheck: Patch(testCollection, First( Filter( testCollection, ID =1 ) ),{A:true, B:true, C:true})
    • OnUncheck: Patch(testCollection, First( Filter( testCollection, ID =1 ) ),{A:false, B:false, C:false})

     

    CheckboxA, B & C: (didn't want to paste 3 times)

    • OnCheck: Patch(testCollection, First( Filter( testCollection, ID =1 ) ),{A, B or C:true})
    • OnUncheck: Patch(testCollection,First( Filter( testCollection, ID =1 ) ),{A, B or C: false});Reset(CheckboxAll)
    • Default: CheckboxAll.Value

     

    When I check "All", it works and all records patch as true

    RubySmith11_1-1627612997431.png

    RubySmith11_2-1627613033399.png

     

    However, when I then UnCheck "A" only, all checkbox visually uncheck (because we are resetting "All") but in the collection ONLY "A" has been reset to false, "B" and "C" are still true

    RubySmith11_3-1627613148825.png

    RubySmith11_4-1627613185894.png

     

    Thanks in advance!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard