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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding multiple code t...
Power Apps
Answered

Adding multiple code to default

(0) ShareShare
ReportReport
Posted on by 302

Hi all.  One more fix before going live with my app.  I have a Gallery from a Sharepoint list that has checkboxes. 

I have  two buttons, a Select All and a Unselect All for the checkboxes. On the OnSelect on the Select All button I have UpdateContext({VarSelectAll: true}) . The OnSelect on the Unselect All button I have UpdateContext({VarSelectAll: false}).

 

Now, I want to add VarSelectAll to the Default on the checkbox called chkServer.   But, I already have a default for the chkServer - If(ThisItem.Status="No",false,true)

 

Is there a way to have 2 codes in a Default setting for this to work? If not, is there a different/better way to do the Select All/Unselect All buttons without adding to the default of the checkbox?

 

Thanks again for all of your help and patients with me.

Tim

Categories:
I have the same question (0)
  • SebS Profile Picture
    4,826 Super User 2026 Season 1 on at

    @Timm1 

     

    yes Just add :

     

    If(ThisItem.Status="No" || !VarSelectAll,false,true)

     

    And it should work

  • Timm1 Profile Picture
    302 on at

    .

  • SebS Profile Picture
    4,826 Super User 2026 Season 1 on at

    @Timm1 

     

    I thought that was what that function should do. It says Select All 🙂 but If Status is "No" It will not check them so You need to change the order and do

    If(!VarSelectAll || ThisItem.Status="No",false,true)
  • Verified answer
    Timm1 Profile Picture
    302 on at

    I played around and found that this works.  

    VarSelectAll || If(ThisItem.Status="No",false,true)
     
    Thank you very much!  Exactly what I needed. 
     
  • Timm1 Profile Picture
    302 on at

    Well, the select all and unslect all with VarSelectAll || If(ThisItem.Status="No",false,true worked until I ran the update button to patch to Sharepoint, when I go back to the gallery, they are all checked and I can't Uncheck with the Uncheck all button.  If I uncheck a few, the Select All and UnSelect All doesn't work.  😞

  • Timm1 Profile Picture
    302 on at

    Howdy!  The Select All function is working great.  But if I reopen the app that has a few check boxes checked, The Unselect All does not uncheck the existing checked boxes.  Is there a way to have my Unselect All button to uncheck existing checkboxes.  The code in my Unselect button is 

    UpdateContext({VarSelectAll: false});UpdateContext({varReset:true});UpdateContext({varReset:false});  I have varReset in the Reset property on the checkbox. 
    Thank you! 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard