cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
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
Highlighted
Community Support
Community Support

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,016)