cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simms7400
Level 8

Patch with ForAll? How to use?

Hi Guys -

 

I have the following Patch logic on one of my forms and it's working fine:

 

If(
	AssetEditForm.Mode <> New,
		Patch(
			rdInvestments,
			LookUp(rdInvestments,CompoundCode=DataCardValue53.Text),
			{CompoundAlias:DataCardValue54.Text}
		)
)

 

 

However, I"m running into an issue where if there are multiple of the same values (DataCardValue53.Text) in my SP list i am patching TO, it only does the first instance it finds. How do I modify this command to ensure it patches all instances?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Level 10

Re: Patch with ForAll? How to use?

Try something like this:

Patch(rdInvestments, Filter(rdInvestments,CompoundCode=DataCardValue53.Text), ForAll(Filter(rdInvestments,CompoundCode=DataCardValue53.Text),
{CompoundAlias:DataCardValue54.Text}))

Let me know if this works for you.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

View solution in original post

3 REPLIES 3
PowerAddict
Level 10

Re: Patch with ForAll? How to use?

Try something like this:

Patch(rdInvestments, Filter(rdInvestments,CompoundCode=DataCardValue53.Text), ForAll(Filter(rdInvestments,CompoundCode=DataCardValue53.Text),
{CompoundAlias:DataCardValue54.Text}))

Let me know if this works for you.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

View solution in original post

Super User
Super User

Re: Patch with ForAll? How to use?

You could try creating an invisible gallery, that is filtered to only contain items where

Filter(rdInvestments,CompoundCode=DataCardValue53.Text)

Then you can run a ForAll against FilteredInvestmentsGalleryName.AllItems

 

There are of course other ways to do it, I like this way so that I can unhide the gallery and check the content if I feel like there's something wrong with the way its filtering (in more complex cases)

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
Highlighted
simms7400
Level 8

Re: Patch with ForAll? How to use?

@PowerAddict   That worked great, thank you!!!

 

@iAm_ManCat  That is a great idea, thank you.  I will try that approach as well. I like the idea of being able to see the elements that will be affected.

 

Thank you, both!!!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,726)