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!
Solved! Go to Solution.
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"}))
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
186 | |
55 | |
42 | |
36 | |
33 |
User | Count |
---|---|
259 | |
78 | |
74 | |
71 | |
68 |