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 nested collec...
Power Apps
Unanswered

Patching nested collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a collection that looks like this:

TeresaRey_0-1608109157324.png

Where OT is the Key of the table.

 

Im trying to patch inside "data" and for that im trying to use this:

Patch(LookUp(colOTOrders;OT=ThisItem.OT).data;colFieldsEdited);;

Where colFieldsEdited is a collection that contains the columns in "data" that needs an update.

 

This is my collection "data"

TeresaRey_3-1608109681614.png

 

and this is my collection "colFieldsEdited"

TeresaRey_2-1608109456250.png

 

My issue here is that this works sometimes, and sometimes it gives me an error "the data source is not valid".

Is there any other way to takle this or avoid the error?

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    the Patch() function typically requires three elements,  a datasource or collection, the record being patched and the field in the record being patched inside curly braces with a colon between the fieldname and the new data to overwrite the old data in that field.  Assuming that the Patch is executed from the OnSelect property of an icon or button from inside the gallery, it should look something like this:

     

    Patch(collectionname,ThisItem,{field:data})

     

     replacing the collectionname with your collection or data source, ThisItem refers to the row in the gallery, and data can be from a control in the gallery row or a lookup to another record if you are patching the datasource of the gallery.  To patch another datasource, replace ThisItem with a Lookup() to the row in the second datasource, typically something like Lookup(datasource2,ID=ThisItem.ID). 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard