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

Saving a Gallery to a SharePoint List

Hi

 

I have a rather large SHarePoint List (1,000s).

 

So my plan was to only filter the list items I wanted (using filter('<ListName>', column1="y" && CoIumn2 ="X"))  and read them into a collection.

 

Update the collection, and write the collection back to the big list.

 

The collection should therefore only have about 30 records in it and I get around any delegation problems.

 

However, when I Write the collection back to the list I hit Problems :-

 

1) If I use Update (<ListName>, Collection) I get an error "Field "Title" : Required.  Yes, one of the fields is called Title (Like all SharePoint Lists, SharePoint insists having a required field called Title in it).  I use the Title Field and I have set it to optional.

 

2) If In use ForAll(GAllery.Allitems,Patch(<ListName>,{ID: ID}, {ListFieldOne : CollFieldOne, ListFieldTwo,CollField2 etc.....})) I get the error "Specified Record record was not found, Server Response: Item Not Found clientRequestId......etc etc

 

How should I write the contents of the collection back to my Big List ?

 

Thanks

 

Nigel

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Saving a Gallery to a SharePoint List

Hi @NigelP,

Do you want to write the collection back to the SP list within your app?

Further, do you use a Gallery to display the collection (filtered records)?

 

Based on the formulas that you provided, I think there is something wrong with the formula that you provided.

 

I have made a test on my side, please modify your formula as below:

 

ForAll(
RenameColumns(Gallery1.AllItems,"ID","ID1"),
Patch(
'YourSPList',
LookUp('YourSPList',ID=ID1), /* <-- Find specific record */
{
ListFieldOne:CollFieldOne,
ListFieldTwo:CollFieldTwo,
...,
ListFiledN:ColFieldN
}
)
)

or

 

 

ForAll(
RenameColumns(
RenameColumns(
RenameColumns(
RenameColumns(
RenameColumns(Gallery1.AllItems,"ID","ID1"),
"ListFieldOne","ListFieldOne1"
),
"ListFieldTwo","ListFieldTwo1"
),
...
),
"ListFieldN","ListFieldN1"
),
Patch(
'YourSPList',
LookUp('YourSPList',ID=ID1),
{
ListFieldOne:CollFieldOne1,
ListFieldTwo:CollFieldTwo1,
...,
ListFiledN:ColFieldN1
}
)
)

 

 

Please also check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Patching-a-Collection-to-SharePoint/m-p/14146...

 

More details about the Patch function in PowerApps, please check the following article:

Patch function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Saving a Gallery to a SharePoint List

Hi @NigelP,

 

You may be able to accomplish your goal with the UpdateIf() function (other advisors may be able to help with this), but If you are working with a collection in your gallery, I'm pretty sure you can save any changes to your underlying datasource on the fly using a standard Edit form.  If your filtered collection was called filteredDS,  you would make this the gallery Items property,  An Edit form with the Datasource property as the orignal unfiltered datasource and the Item property would be Lookup(datasource,ID=Gallery.Selected.ID) since the Gallery and the Edit form have different datasources.  When the form is submitted, refresh the filteredDS using ClearCollect(filteredDS,Filter(...) in the OnSuccess property of the Edit form, then the gallery will reflect the changes.  

Community Support Team
Community Support Team

Re: Saving a Gallery to a SharePoint List

Hi @NigelP,

Do you want to write the collection back to the SP list within your app?

Further, do you use a Gallery to display the collection (filtered records)?

 

Based on the formulas that you provided, I think there is something wrong with the formula that you provided.

 

I have made a test on my side, please modify your formula as below:

 

ForAll(
RenameColumns(Gallery1.AllItems,"ID","ID1"),
Patch(
'YourSPList',
LookUp('YourSPList',ID=ID1), /* <-- Find specific record */
{
ListFieldOne:CollFieldOne,
ListFieldTwo:CollFieldTwo,
...,
ListFiledN:ColFieldN
}
)
)

or

 

 

ForAll(
RenameColumns(
RenameColumns(
RenameColumns(
RenameColumns(
RenameColumns(Gallery1.AllItems,"ID","ID1"),
"ListFieldOne","ListFieldOne1"
),
"ListFieldTwo","ListFieldTwo1"
),
...
),
"ListFieldN","ListFieldN1"
),
Patch(
'YourSPList',
LookUp('YourSPList',ID=ID1),
{
ListFieldOne:CollFieldOne1,
ListFieldTwo:CollFieldTwo1,
...,
ListFiledN:ColFieldN1
}
)
)

 

 

Please also check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/General-Discussion/Patching-a-Collection-to-SharePoint/m-p/14146...

 

More details about the Patch function in PowerApps, please check the following article:

Patch function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

NigelP
Level 8

Re: Saving a Gallery to a SharePoint List

Hi @v-xida-msft

 

I have tried this and there appears to be a problem.  

 

When i initially insert the records I then refresh the collection by ClearCollect(myCollect, Filter(MyList, filter1  = condition1 && Fileter2 = Condition2).  This should update the ID column in the collection to reflect the actual IDs of my data in MyList.  So that I can use the ID in your formula above.  But the ID does not get updated, but stays the same.

 

ANyone anyideas ?

 

Thanks

 

Nigel

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

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

Top Solution Authors
Top Kudoed Authors
Users online (5,946)