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 / Trying to Patch all it...
Power Apps
Answered

Trying to Patch all items displayed in a gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

"Table1" in Excel is data source.

BrowseGallery1 is the Gallery


I have added one checkbox to the top of the page. 

If this is checked by the user, I am trying to patch all items the gallery.  I would like to patch the column name 'Selected' to "Y".

 

I am trying this, I can see it doesn't look right, but I just can't figure out what I need to do to solve. 

 

 

Patch(Table1,BrowseGallery1.AllItems,{Selected: "Y"})

 

 

Any help would be most appreciated, thank you.

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    Try:

    ForAll(
    Gallery1.AllItems,
    Patch(TableName,
    LookUp(TableName,
    ColumnName="Y"),
    {Created_by: User().Email,
     Created_On: Today()}))
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, 

     

    I've had to amend it a bit to:

     

    ForAll(Gallery1.AllItems,Patch(Table1,LookUp(Table1,Selected<>"Y"),{Selected: "Y"}))

     

    I'm still testing it out it seems to work so far, but it's only patching the first 10 items for some reason - really not sure why.

  • eka24 Profile Picture
    20,925 on at

    How many rows do you have.

    You can goto Settings-Advanced setting to increase the delegation limit to 2000.

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi 🙂

     

    I'm just testing it at the moment so there's only about 20 rows or so, but it's just the first 10 rows only that it's patching at the moment.

     

    I've just double checked at that one's already set to 2000 =/

     

     

  • eka24 Profile Picture
    20,925 on at

    I made a test and everything works fine. Does all the 20 meet the<> criteria for them to be Patched

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to patch the "Selected" column of all items in your Gallery when you check the Checkbox control?

     

    I have made a test on my side, and don't have the issue that you mentioned. Please consider modify your formula as below:

    ForAll(
     RenameColumns(Gallery1.AllItems, "PrimaryColumn", "PrimaryColumn1"),
     Patch(
     Table1,
     LookUp(Table1, PrimaryColumn = PrimaryColumn1),
     {
     Selected: "Y"
     }
     )
    )

    Note: I assume that your Gallery1 is connected to your Table1. The 'PrimaryColumn' represents the column in your Table1, which could identify one record uniquely.

     

    Actually, I think it is not necessary to use ForAll function to achieve your needs. I think the UpdateIf function is enough to achieve your needs. Please set the OnCheck property of the Checkbox to following:

    UpdateIf(
     Table1,
     true,
     {
     Selected: "Y"
     }
    )

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

     

    Not sure why yours is working and mine isn't 😞

     

    If I'm thinking about this right, the column should be binary, either being not equal to Y   ➡️ <>Y     or "Y"

     

    So if it's already "Y", it leaves it alone, and if it isn't "Y" it changes it to "Y" (if that makes sense!) 🙂

     

    So, all 20 should meet one criteria or the other, either being left alone or changed - if I set all 20 records the "N", it only updates the first 20.

     

    It should update all items in the gallery - there are some filters present on the gallery, however I've set all these to the widest parameters so all 20 records are displaying in the gallery at the mo.

     

    Thanks again for you help 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi, 

     

    That's a good shout on the UpdateIf - I haven't come across that one before - I'll try that while I'm working on this again a little later today.

     

    Would you mind talking me through this step by step?  I can kinda see what it's doing and I think that this might work for what I need, I'm just struggling to fully get my head around how it's working a bit:

    ForAll(
     RenameColumns(Gallery1.AllItems, "PrimaryColumn", "PrimaryColumn1"),
     Patch(
     Table1,
     LookUp(Table1, PrimaryColumn = PrimaryColumn1),
     {
     Selected: "Y"
     }
     )
    )

    Thank you again so much! 🙂

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Yeah, you could take a try with the UpdateIf function to achieve your needs.

     

    If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for getting back to me.

     

    Would you mind talking me through what this is doing this step by step?  I can kinda see what it's doing and I think that this might work for what I need, this is just a new one on me and I'm just struggling to fully get my head around how it's working a bit:

    ForAll(
     RenameColumns(Gallery1.AllItems, "PrimaryColumn", "PrimaryColumn1"),
     Patch(
     Table1,
     LookUp(Table1, PrimaryColumn = PrimaryColumn1),
     {
     Selected: "Y"
     }
     )
    )

    Thank you again so much! 

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard