I have a situation that looks like this:
A: {var1:"", var2:"", var3:"", var4:"", var5:""}
B: {var2:"foo", var5:"bar"}
Record A has no values but contains all possible properties for a dataset. Record B has values but is incomplete (and will have different properties on each occasion).
I simply need to add the values of B to A. However, because it is not possible to loop through a record like one would a list, the only I way see of doing it is like this:
try
set var1 of a to var1 of b
end try
try
set var2 of a to var2 of b
end try
… and so on for every property of A.
That is fine for a short record. However, my actual use case involves a record with 60+ possible properties, which makes this brute force approach inelegant to say the least.
If I could get a list of every property of B then I could loop through by using run script
to reference each property in turn. However, I’m not sure if that’s possible with vanilla AppleScript. If I could get the source of B as plain text then I could simply get the properties by regex, but I’m not sure how that can be done either.
Any advice as ever gratefully received!