cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Bri
Level 8

Patch all fields of a collection to a SharePoint List

I need to be able to patch all columns from a collection, to a sharepoint List. What happens is, the patch only carries over the default columns of the sharepoint List. How can i loop through my collect and use patch to insert all the data into a list!

5 REPLIES 5
Community Support Team
Community Support Team

Re: Patch all fields of a collection to a SharePoint List

Hi @Bri,

 

We could take use of forall function to loop through the collection and then insert each row of the collection into SharePoint list.

ForAll function in PowerApps

Please check and see if the thread below would help:

Patch a collection of items to SharePoint List

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Bri
Level 8

Re: Patch all fields of a collection to a SharePoint List

I have tried this before, the problem is, is that the patch only carries over the default fields of the sharepoint list. The Title, Modified by, created, etc. Any fields of data i have added to the list do not carry over, even if i made both lists the same.

 

Example:

List1 fields are tracking_ID, Name, Item.

List2 fields are item_TrackingID, renterName, ItemName

 

How would i insert a record from List1 into List2 where the fields line up.

Patch(List2, {List2.item_TrackngID: List1.tracking_ID, List2.renerName: List1.Name, List2.ItemName: List1.Item})

 

Does this example now make sense? Because i am still having problems!!!!!

Microsoft Robert76
Microsoft

Re: Patch all fields of a collection to a SharePoint List

For a new entry have you tried the following notation: Patch(List2,Defaults(List2),{ColumnAList2:List1.ColumnA.Value,ColumnBList2:List1.ColumnB.Value}) and for an existing entry: Patch(List2,First(Filter(List2,ID=IdOfListItemInList2YouWantToUpdate)),{ColumnAList2:List1.ColumnA.Value,ColumnBList2:List1.ColumnB.Value})

Bri
Level 8

Re: Patch all fields of a collection to a SharePoint List

Yes i have tried that notation for a new entry. The problem is when you do List1.ColumnA that is a table type. You can NOT do List1.ColumnA.Value, that is invalid syntax. I wish you could do that, cause then that would solve my problem.

MelindaK
Level 8

Re: Patch all fields of a collection to a SharePoint List

Not completly sure, but I have a feeling you need to use Filter on List1. As your error says is a table type - it sounds like is taking all the values from that column, so I think you need to filter the exact value from List1 that you want to put it in List2.

So it would be something like:
Patch(List2, Defaults(List2), {ColumnAList2: First(Filter(List1, condition)).Column})
MelindaK

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,660)