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 / How to Update single v...
Power Apps
Answered

How to Update single value of collection / all values of a collection?

(1) ShareShare
ReportReport
Posted on by 235

Hello, I am using a collection to generate a dataset.

 

 

 ClearCollect(
 colExample,
 {
 Section: true,
 Environment: true,
 Test: false,
 Dev: false,
 Prod: false
 },
 {
 Section: true,
 Environment: true,
 Test: false,
 Dev: false,
 Prod: false
 },
 {
 Section: true,
 Environment: true,
 Test: false,
 Dev: false,
 Prod: false
 },
 {
 Section: true,
 Environment: true,
 Test: false,
 Dev: false,
 Prod: false
 }
 )

 

 To visualize this dataset I use a vertical gallery with "check boxes".

 

gal_Example
 chk_Section
 chk_Environment
 chk_Test
 chk_Dev
 chk_Prod

 

Now I have to questions:

  1. I want to change the values of the collection by clicking on the check boxes inside the gallery. I tried to use Patch() with no success.
  2. Outside the gallery I want to place a check box for each value (Section, Environment, Test, Dev, Prod). By clicking on this single checkbox, all values of the corresponding value in the collection should change to value of the check box. I tried to do it with UpdateIf() but had no success.

Can someone give me a hint how to solve this?

 

Thanks for your support.

Michael

Categories:
I have the same question (0)
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @MichaGue,

     

    (1) You will have to make the records distinguishable in order to correctly patch them (e.g. add a temp ID field):

     ClearCollect(
     colExample,
     {
     ID: 1,
     Section: true,
     Environment: true,
     Test: false,
     Dev: false,
     Prod: false
     },
     {
     ID: 2,
     Section: true,
     Environment: true,
     Test: false,
     Dev: false,
     Prod: false
     }
    // and so on...

     

    (2) The checkbox within your gallery will need the following code (Dev checkbox as an example):

    //OnCheck
    Patch(colExample, ThisItem,{Dev: true})
    
    //OnUnCheck
    Patch(colExample, ThisItem,{Dev: false})
    
    //Default
    ThisItem.Dev

     

    (3) In order to bulk change all status values for a particular column (Dev column as an example)

    //OnCheck
    UpdateIf(colExample, true,{Dev: true})
    
    //OnUnCheck
    UpdateIf(colExample, true,{Dev: false})
    
    //Default (only checked when all values are true)
    CountIf(colExample,Dev) = CountRows(colExample)

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

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 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard