cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rorybi
Kudo Commander
Kudo Commander

Patch a collection of items to SharePoint List

Hi All,

 

I'm struggling with this one.  I have a use case where I would like to be able to use my app to create offline stats for childrens football (mainly because it would take too long to interact with sharepoint and I might not even have good reception).

 

I have a collection that I am trying to post to sharepoint.  SpotsStats is my Sharepoint List.  cnStats is my collection.

 

 

SportStats.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The following syntax works (although it is nonsense!)

ForAll(cnStats,
Patch(SportStats, Defaults(SportStats),
{Weather: "My Weather Test"}))

 

When this code runs I end up with 4 rows in sharepoint (corresponding to the fact I have 4 rows in my collection).

 

My real objective is to do something along the following lines (see below) but it's not working:-

 

ForAll(cnStats,
Patch(SportStats, Defaults(SportStats),
{ ActionIndex: cnStats.Index, Action: cnStats.Action, Half: cnStats.Half,Result: cnStats.Result,Weather: cnStats.Weather})

 

Even the following is invalid syntax

 

ForAll(cnStats, 
Patch(SportStats, Defaults(SportStats), 
{Result: cnStats.Result})

 

This would suggest that the problem is with the cnStats.Result.  I've tried wrapping this in a text function Text(cnStats.Result) but still no joy.

 

Any ideas what I'm missing as it's pretty frustrating.

21 REPLIES 21

hi ScottRMeredith,

I would say that your collection CalShopCart already has a column called "field_0", and this is the Name column... that's why you can't add a 2nd column with the same name.

It's a total pain when the column names get all jacked up so I suggest to recreate the Sharepoint List... If you have it on an Excel file it should be very easy to create it again and reuse your previous data and a new List. Make sure your table column name have no space or weird character to avoid jacked names again.

@SergiP 

I got it worked out as I forgot I had extra columns in my collection that were not on my sharepoint list.  I ended up creating a new collection with just the columns I needed and it worked.  Thanks for the reply.  

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,725)