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

Updating multiple records in a Shartepoint list using Patch

 

I have a PowerApp which saves data to a Sharepoint list called Beds In. Within the PowerApp there is a second part to it whereby I need to save a name to each of the records in the Sharepoint list where the unique reference field matches.

 

I have tried this to look for each of the REF fields that match but it only updates the first instance it finds and not all instances.

 

 

Patch('Beds In', LookUp('Beds In',Ref=ESF_Ref.Text), { Print_Name: ESF_PrintName.Text } );

 

Any ideas how I can make this work so that for each record where Ref = ESF_Ref.Text it updates the Print_Name field with the value in ESF_PrintName.Text

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Updating multiple records in a Shartepoint list using Patch

Hi @Daveed73,

 

What is your current situation?

 

To update multiple records, we could either take use of the forall function, or the UpdateIf () function.

 

ForAll first:

Forall('Beds In', 
     If(Ref=ESF_Ref.text, 
         Patch('Beds In', 
                   LookUp('Beds In',Ref=ESF_Ref.Text), 
                   { Print_Name: ESF_PrintName.Text } )
        )
)

With the UpdateIf function, the formula should be:

UpdateIf('Beds In', Ref=ESF_Ref.text, {Print_Name: ESF_PrintName.Text})

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
Super User
Super User

Re: Updating multiple records in a Shartepoint list using Patch

You are going to need to use ForAll in conjunction to loop through all the records. Check out this video I did on Repeating Tables. I do very similiar to what you want to do, just in a different context. My save button loops through all of the records and creates them, you would just need to look through and edit.

 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Community Support Team
Community Support Team

Re: Updating multiple records in a Shartepoint list using Patch

Hi @Daveed73,

 

What is your current situation?

 

To update multiple records, we could either take use of the forall function, or the UpdateIf () function.

 

ForAll first:

Forall('Beds In', 
     If(Ref=ESF_Ref.text, 
         Patch('Beds In', 
                   LookUp('Beds In',Ref=ESF_Ref.Text), 
                   { Print_Name: ESF_PrintName.Text } )
        )
)

With the UpdateIf function, the formula should be:

UpdateIf('Beds In', Ref=ESF_Ref.text, {Print_Name: ESF_PrintName.Text})

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,965)