cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Davidx23
Advocate I
Advocate I

For Each function in PowerApps

Hi everyone

 

Is there a way to Patch a text value to many items in just one click from powerapps?

 

I have a permission app with a dashboard which i'd like to add a buttom that patch the value "Approved" to a text column but i wonder if i can do this from PowerApps without going to PowerAutomate?

 

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
metsshan
Solution Sage
Solution Sage

Hey, in general there are multiple ways to bulk update a data source. Here are two examples which perform the same update:

//Make changes to all records which satisfy an expression
UpdateIf(People, Active = false && Status.Value = "Done", {Active: true});

//Cache List data in a collection, update the collection in memory, then Patch all changes at once.
ClearCollect(colPeople, Filter(People, Active = false));
UpdateIf(colPeople, Status.Value = "Done", {Active: true});
Patch(People, colPeople);

metsshan_0-1658931763606.png

 

 

View solution in original post

5 REPLIES 5
AJ_vizMan
Helper V
Helper V

Hi @Davidx23 - Can you explain the scenario bit more along with purpose of patching, data source etc.

 

As per my current understanding, your scenario matches what Matthew Devaney has already put in a nice blog post.

Take a look : 

PATCH Multiple Records In Power Apps 10x Faster - Matthew Devaney

 

 

metsshan
Solution Sage
Solution Sage

Hey, in general there are multiple ways to bulk update a data source. Here are two examples which perform the same update:

//Make changes to all records which satisfy an expression
UpdateIf(People, Active = false && Status.Value = "Done", {Active: true});

//Cache List data in a collection, update the collection in memory, then Patch all changes at once.
ClearCollect(colPeople, Filter(People, Active = false));
UpdateIf(colPeople, Status.Value = "Done", {Active: true});
Patch(People, colPeople);

metsshan_0-1658931763606.png

 

 

NandiniBhagya20
Solution Sage
Solution Sage

Hi ,
First you will have to create a collection: ClearCollect(patchCol,SPListName)
Then you will have to update this collection: UpdateIf(patchCol, true, {Status: {Value: "Completed"}})
At last you will have to update your data source that is SP List: Patch(SPListName, patchCol)
ClearCollect(patchCol, SPListName);UpdateIf(patchCol, true, {Status: {Value: "Completed"}});Patch(SPListName, patchCol)


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
NandiniBhagya20
Solution Sage
Solution Sage

If you have any filter or conditions you can pass them in UpdateIf. in above example it will update all rows


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

I solved it using UpdateIf function. Thanks so much man

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (2,433)