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 / Select all/Unselect al...
Power Apps
Answered

Select all/Unselect all checkboxes with a click on a button

(0) ShareShare
ReportReport
Posted on by

Hi guys,

 

need your help with some checkboxes I've put inside a gallery.

I can select each one of them one by one and on "oncheck" property i've put this formula Patch(collection; ThisItem; {Selected: true}).

What I have to put on a new button in order to select all (and in case unselect all) of them in the same time?

 

Many thanks

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    Hi @Sesese ,

    You could set a Variable

    UpdateContext({varChecked: true})

    then the Default of the gallery checkbox

    varChecked

    at screen OnVisible

    UpdateContext({varChecked: false})

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Sesese Profile Picture
    on at

    Hi, thank you for the answer.

     

    How can I update the collection change the value from false to true?

  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    @Sesese ,

    With a Patch - you need to have a unique identifier on the record - I have used SharePoint ID here, but replace with yours if this is not the case.

    Patch(
     Collection,
     ForAll(
     Gallery.AllItems As aPatch,
     {
     ID: aPatch.ID,
     Selected: true
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Sesese Profile Picture
    on at

    With this formula it gives me error and I can't change value on the collection to true.

     

     

  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    @Sesese ,

    Do you have the ID in the collection content ? Also what is your data source ?

  • Sesese Profile Picture
    on at

    ID is the ID standard from the sharepoint list, the collection is called "CollectionFleet" from the SP list "Fleet" and the gallery is called "Fleetgallery"

  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    @Sesese ,

    Yes, but how is the collection made - It needs the ID in it for this to work - you need to identify the record to be patched.

  • Sesese Profile Picture
    on at

    It continues to give me error.

    The ID is inside the gallery and this is the formula I'm using

     

    Patch(collectionFlotta;ForAll(Lista_Flotta.AllItems As aPatch;{ID: aPatch.ID; Selezionato: true}))

     

    but doesn't work

  • WarrenBelz Profile Picture
    156,275 Most Valuable Professional on at

    @Sesese ,

    I will clarify all the elements here (I have changed the code slightly, but it really is no different)

    Patch(
     collectionFlotta;
     ForAll(
     Lista_Flotta.AllItems As aPatch;
     {ID: aPatch.ID}; 
     {Selezionato: true}
     )
    )
    •  You are updating a record in the Collection collectionFlotta which contains the ID (from SharePoint) of the record you want to update. Go to View > Collections > collectionFlotta and confirm the ID is there.
    • You have a Gallery called Lista_Flotta which also contains the ID of this record. Put a label in the gallery with ThisItem.ID and ensure the value is the same as the record you have just looked at in the collection.

    If all of the above is true, the code will work.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Sesese Profile Picture
    on at

    Now it is saying that "the data source supplied to the function is invalid".

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard