Dear all,
I have to admit I have problems in processing records …
My question is: how can update Record1 with values of Record2?
If I have Record1 and Record2 as detailed below:
set Record1 to {a:1, b:3, c:5, d:7, e:11}
set Record2 to {b:30, d:70, e:11}
How can I use the values of Record2 to update those (an only those) on Record1, so that my result should be:
→ Record1 as {a:1, b:30, c:5, d:70, e:11}
Thanks !
Hi.
If Record2 only contains properties that are in Record1, you can concatenate Record1 to it:
set Record1 to {a:1, b:3, c:5, d:7, e:11}
set Record2 to {b:30, d:70, e:11}
set Record1 to Record2 & Record1
--> {b:30, d:70, e:11, a:1, c:5}
You can also do this if Record2 has properties which aren’t in Record1, but the result will have the additional properties from Record2. Basically, if you concatenate two records, the result will have the properties from both records, with the values from the left-hand record being used where the labels are the same.
set Record1 to {a:1, b:3, c:5, d:7, e:11}
set Record2 to {b:30, d:70, e:11, z:"Hello"}
set Record1 to Record2 & Record1
--> {b:30, d:70, e:11, z:"Hello", a:1, c:5}}
Thanks a lot!
That’s exactly what I was looking for. Thanks !