cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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 III
Super User III

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 III
Super User III

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

Frequent Visitor

Timl

 

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

Frequent Visitor

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

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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (7,816)