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

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,883)