cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jimbo1
Level: Powered On

Patch from Collection then remove record

Hi,

I have developed an app that will work offline, when connected I have been able to patch the records from the collection to a sharepoint list. This is working fine, Is there a way to build into the ForAll function to delete the record from the collection once the record has been patched to the sharepoint list?

 

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Patch from Collection then remove record

Hi @Jimbo1,

 

" have been able to patch the records from the collection to a sharepoint list. "

 

Could you please explain a bit for how the patch works to save the collection data into SharePoint list?

 

As shared by @Eickhel, patch function would return the updated record once it succeed, so if here you are using forall () to patch the collection, the formula should be:

Forall(Collection, patch(SPList, ....))

You could either trying the following:

1. Use Collect within the Forall Patch, to collect the updated record, then remove it from the collection:

Forall(Collection, Collect(RemoveData, patch(SPList, ....)))

 2. After that, use lookup function to map the record in the old collection, and remove the records found:

Remove(Collection, Filter(Collection, ID in RemoveData.ID))

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.

View solution in original post

2 REPLIES 2
Eickhel
Level 8

Re: Patch from Collection then remove record

Hey,

 

The patch method returns the patched record so you can check if the records have been successfully patched. Regarding the deletion, why don't you use the Clear method to empty the collection?

Highlighted
Community Support Team
Community Support Team

Re: Patch from Collection then remove record

Hi @Jimbo1,

 

" have been able to patch the records from the collection to a sharepoint list. "

 

Could you please explain a bit for how the patch works to save the collection data into SharePoint list?

 

As shared by @Eickhel, patch function would return the updated record once it succeed, so if here you are using forall () to patch the collection, the formula should be:

Forall(Collection, patch(SPList, ....))

You could either trying the following:

1. Use Collect within the Forall Patch, to collect the updated record, then remove it from the collection:

Forall(Collection, Collect(RemoveData, patch(SPList, ....)))

 2. After that, use lookup function to map the record in the old collection, and remove the records found:

Remove(Collection, Filter(Collection, ID in RemoveData.ID))

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.

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 78 members 3,817 guests
Please welcome our newest community members: