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

Editing complete column of collection

Hello everybody

 

Over the last couple of weeks i have learned a lot from you guys from reading the answers on this forum but i have an issue which i can't solve on my own.

 

I have created an input form and my data is saved into a collection(ProductList2) Now i want to add a button which can edit all the records in one column (column name = "Product") of the entire collection based on the input of a textbox. This is what i came up with but it doenst do the trick

 

ForAll(ProductList2; Patch(ProductList2.Product; {Product : TextInput1.Text }))

 

Can someone help me please

 

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Editing complete column of collection

Hi @rogierv 

A quick way to update all the records in a collection is to use the UpdateIf function. The syntax would look like this:

 

UpdateIf(ProductList2; 
true;
{Product : TextInput1.Text }
)

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Editing complete column of collection

Hi @rogierv 

A quick way to update all the records in a collection is to use the UpdateIf function. The syntax would look like this:

 

UpdateIf(ProductList2; 
true;
{Product : TextInput1.Text }
)

View solution in original post

rogierv
Level: Powered On

Re: Editing complete column of collection

Timl

 

Thank you for this solution. How simple can it be. You helped me a lot

rogierv
Level: Powered On

Re: Editing complete column of collection

Timl

 

Would you advise to always use Updat and UpdatIf when you use a collection? Because I used PATCH before. When i would use Update and want to change one cell in a row with the patch function that would be

 

Patch(ProductList2;Gallery3.Selected; {Product : TextInput1.Text })

But with the UPDATE function this is not gonna work

Super User
Super User

Re: Editing complete column of collection

Hi @rogierv 

In general, we would use Patch to modify or add a single record to a datasource/collection, and UpdateIf to update multiple records.

The Update function works a bit differently to Patch because it replaces a record in a data source with the record you specify, whereas Patch modifies the target record.

When updating a single record, one thing to be aware of is that Patch doesn't handle null values very well. In these circumstances, the UpdateIf function can provide a workaround.

https://powerusers.microsoft.com/t5/General-Discussion/Patch-not-updating-on-null-values-in-database...

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
Users Online
Currently online: 226 members 5,925 guests
Please welcome our newest community members: