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 / Unable to Patch multip...
Power Apps
Answered

Unable to Patch multiple gallery records in PowerApps

(0) ShareShare
ReportReport
Posted on by 220
Hi,
 
I have a gallery linked to a SharePoint List.
 
A user may update 4 columns in the gallery, but can update multiple records in the gallery, but I only want to patch the update to the gallery.
 
I am struggling to get the patch to work having tried UpdateIf and ForAll. 
 
Gallery Name : CityhopGallery
SharePoint List : CityhopList
CollectionName : colGalUpdates
 
I have a Save button and the code looks like this:
Clear(colGalUpdates);
 
Collect(colGalUpdates,
ShowColumns(
Filter(CityhopGallery.AllItems, ThisRecord.CityhopComments <> galNotes.Text), Title, ID, OutSource, 'Write-Off', CityhopComments, CollectionsComment));
 
ForAll(
 colGalUpdates,
 With(
 {
 _title: ThisRecord.Title,
 _Outsource: galOutsource.SelectedText.Value,
 _WriteOff: drpWriteOff.SelectedText.Value,
 _CHComment: galNotes.Text,
 _ColComment : galColNotes.Text
 },
 Patch(
 CityhopList,
 LookUp(colGalUpdates, ID= CityhopGallery.Selected.ID),
 {
 Title: ThisRecord._title,
 OutSource:ThisRecord._Outsource,
 'Write-Off': ThisRecord._WriteOff,  
 CityhopComments: ThisRecord._CHComment,
 CollectionsComment: ThisRecord._CHComment
}
 )
 )
 );
 
 Refresh(CityhopJune2025);
 
Any ideas would be greatly appreciated!
 
Kind regards
 
Rene Voller
Categories:
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,034 Super User 2026 Season 1 on at
     
    I only want to patch the update to the gallery .
     
    With respect to this problem statement what is your expectation Patch the update to the gallery its quite confused. 
     
    A gallery is control which is typically connected to a DataSource (SQL, SharePoint, Dataverse, Collection, etc.,) any manipulations / editing to the gallery item which will change the data in the datasets as well after the update happened to datasource, Refresh(Datasource) will change the dataset as well.
     
    What is the Item Property of the Gallery are you referring the Datasource directly (sharepoint) or you using the collection. 
     
    If you are pointing to the DataSource directly after the patch Refresh(datasource) will help you update of records in the gallery.
     
    However if you are using Collection in the Items, after the patch try navigating to the same screen or you have created some collection right using ClearCollect or Collect do that again. 
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at
    Firstly, you can try this structure - I have some questions on the highlighted items as to whether they are outside the CityhopGallery as seperate controls (and also not in another gallery)
    With(
       {
          _City:
          Filter(
             CityhopGallery.AllItems, 
             CityhopComments <> galNotes.Text
          )
       },
       Patch(
          CityhopList,
          ForAll(
             _City As _Data,
             {
                ID: _Data.ID,
                 Title: _Data.Title,
                 OutSource: galOutsource.Selected.Value,
                 'Write-Off': drpWriteOff.Selected.Value,  
                 CityhopComments: galNotes.Text,
                 CollectionsComment: galColNotes.Text
             }
          )
       )
    )
    This should be easy enough to do - I just need to know where you are getting all the values from.
     
    Please ✅ Does this answer your question 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 a Like.
    Visit my blog Practical Power Apps    LinkedIn   
  • RVoller Profile Picture
    220 on at
    Thanks @WarrenBelz for the kind response.
     
    I did previously try your suggested solution, but I kept getting the error : Invalid argument type (Table), expecting record instead.
    I tried changing the galnotes.text to _city.galnote and then to thisrecord.galnotes and a number of other 'guesses'.
     
    This is where I hit a blocker and could not get the Patch to work.  I'm not sure what else to try.
     
    By the way, I only have one gallery and one sharepoint list to update.  It should be fairly easy, but none of the solutions I have tried seem to work.  Not sure what else I could try.
     
     
    Kind regards
  • WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at
    Firstly if I can understand exactly where all your references are coming from, this is not a difficult process.
     
    From what you have posted, you have a Gallery CityhopGallery which you want to filter for records where the CityhopComments field is not equal to galNotes.Text, so my first question is what and where is the value  galNotes.Text coming from,
     
    You are then patching all of these filtered records to CityhopList, with the ID of both the gallery and the data source matching. In your input you refer to a number of values, in particuar galNotes.Text and galColNotes.Text, so my similar question is where you are getting these from.
     
    The error you are getting is logical if these values are not single text values.
     
     
     
  • WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please ✅Does this answer your question 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 a Like.
    Visit my blog Practical Power Apps    LinkedIn   
  • RVoller Profile Picture
    220 on at
    Good day @WarrenBelz,
     
    Thank you for the follow-up post.  It is valued.
     
    I had a look at the solution once again,  and could not get the ForAll to work. 
     
    I essentially have a gallery with dropdowns and additional free text fields that the user needs to populate.
     
    So, I changed the design somewhat, and added a Patch on the Onchange of the fields where the user needs to add data.
     
    This simple solution is working.  It means that I don't have to Patch at the end or have an additional 'Save' button for the user to click.
     
    Given that the SharePoint DataSource is not more than 400 records, I believe this will work.
     
    On to the next Challenge!
     
    Kind regards
     
     
    Rene Voller
  • Verified answer
    WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at
    Good that you got it working.

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

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,074

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 606

Last 30 days Overall leaderboard