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 / Patching collection ba...
Power Apps
Answered

Patching collection back to sharepoint error

(0) ShareShare
ReportReport
Posted on by 22

Hi, 

I have a gallery of items that are in a sharepoint list. This gallery is an editable grid and I am trying to patch back the new data if a value has been changed. However, for my "Submit" button to save my data, my patch function is not working because my collection is a table and a not a record. I have attached all my code I have used to make my gallery editable. 

APP: ON START

helpmee_0-1659117632169.png

GALLERY ITEMS: ON CHANGE

helpmee_1-1659117743890.png

BUTTON: ON SELECT

helpmee_2-1659118110777.png

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @helpmee 

    First, I see that you have the ID defined in your initial collection, but are not updating that at any point later, so even if your Patch works, it will be creating new records for everything.

    Your OnChange formula is a bit of an overkill in that you are duplicating the record - just a lot of typing and maintenance later on.

     

    And finally, you are also then duplicating all of your gallery data into yet another collection/table.  The Gallery already is a table - you can use that.

     

    What I would recommend is the following.  Use a collection only to keep track of what record is changed and get rid of all the rest.

     

    So, your OnStart formula for the collection can all go away and then your OnChange formula would simply become:  Collect(colResponse, ThisItem.ID)

     

    Then finally, your Patch would become this:

    Patch('xxxx Entries',
     ForAll(Distinct(colResponse, Value),
     With(LookUp(yourGallery.AllItems, ID=Result),
     {ID: ID,
     xxxx: DataCardValue45_1.Text,
     Damage: DataCardValue46_1.SelectedItems.'xxx', 
     ...etc...
     }
     )
     )
    );
    Clear(colResponse)

     

    Now, with that, if you still have a Patch error that shows "expecting a record", then the names of your columns are not correct.  The names need to be the exact "real names" of the columns.  If you have renamed any columns, you will need to get the original name of the column (as you can never rename a column) and use that.

    After that it should all work fine.

     

    I hope this is helpful for 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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 396 Most Valuable Professional

#2
11manish Profile Picture

11manish 134 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 101 Super User 2026 Season 2

Last 30 days Overall leaderboard