cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FlowHawk
Helper III
Helper III

Update value from only one column in local record

I've got a local record in an app (recTestRecord). I set the record like this:

Set(recTestRecord, {Column1: "value1", Column2: "value2", Column3: "value3"});


I only want to update one column value and leave the rest untouched. How do I do that? I expected this to work:

Patch(recTestRecord,{Column1:"NewValue"})

 

But nothing happens.

 

I was able to get something to work, but it doesn't seem like the right way to do it.

Set(recTestRecord, {Column1: "value1", Column2: "value2", Column3: "value3"});
ClearCollect(colTestTable, Table(recTestRecord));
Patch(colTestTable,recTestRecord,{Column1: "NewValue"});
Set(recTestRecord, First(colTestTable));

 

Any help on updating one column of a locally stored record would be helpful!

1 ACCEPTED SOLUTION

Accepted Solutions

I see. Is the column to be changed consistent? If so you could try updating the variable record as follows:

 

Set(recTestRecord, Patch(recTestRecord, {C1:"NewValue1"}))

View solution in original post

6 REPLIES 6
AmDev
Super User
Super User

Hi @FlowHawk 

 

You could try the following to update just one field in the record variable:

 

Set(recTestRecord,{C1:"NewValue1", C2:recTestRecord.C2 , C3:recTestRecord.C3})

 

Hope this helps.

.

Thanks for the thought, but in reality my use case is dozens of columns. It's not feasible for me to update the record in that way.

I see. Is the column to be changed consistent? If so you could try updating the variable record as follows:

 

Set(recTestRecord, Patch(recTestRecord, {C1:"NewValue1"}))

Brilliant, I had no idea that you had to do the set on the patch. It confused me that this would work with a datasource but not with a local record variable. Much thanks!

That's great - glad that worked our for you.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,349)