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 }
)
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 }
)
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
firstImage

PowerApps Monthly Community Call!

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

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: 364 members 4,983 guests
Please welcome our newest community members: