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

patch the multiple items where condition satisfies

Hello Team, I'm trying to patch the multiple items where condition satisfies but with below formula, It is patching only first item.

 

Patch('[dbo].[Table]',ColumnName1="Text"),{ColumnName2:"YES"})

 

i want to patch all items in ColumnName2 with "YES" where It finds ColumnName1="Text" in dbo].[Table]

 

Please help.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: patch the multiple items where condition satisfies

For updating multiple records that match a condition, use the UpdateIf function rather tha Patch. Patch is for adding or updating a single record.

To *add* multiple records you can use Collect.

Super User
Super User

Re: patch the multiple items where condition satisfies

@vshah804 

Consider using the UpdateIf function for this operation. 

UpdateIf will update records based on a criteria.

 

Your formula would be as follows:

UpdateIf('[dbo].[Table]', ColumnName1="Text", {ColumnName2: "YES"})

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
4 REPLIES 4
Super User
Super User

Re: patch the multiple items where condition satisfies

For updating multiple records that match a condition, use the UpdateIf function rather tha Patch. Patch is for adding or updating a single record.

To *add* multiple records you can use Collect.

Super User
Super User

Re: patch the multiple items where condition satisfies

Take a look at the following article.  It shows how to patch multiple records in a Batch using Patch and ForAll.

https://powerapps.microsoft.com/en-us/blog/bulk-update-using-forall-and-patch/



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: patch the multiple items where condition satisfies

@vshah804 

Consider using the UpdateIf function for this operation. 

UpdateIf will update records based on a criteria.

 

Your formula would be as follows:

UpdateIf('[dbo].[Table]', ColumnName1="Text", {ColumnName2: "YES"})

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
vshah804
Level: Powered On

Re: patch the multiple items where condition satisfies

Thanks a lot. It works like a charm!Smiley Happy

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 307 members 4,366 guests
Please welcome our newest community members: