I’d like to extract a large sequence of record values, eventually manipulating them each to their own line for easier reading. I’m easily able to enlist the values of the pair into a list with something like my example, below, but I haven’t yet found a way to refer to the keys themselves without naming them (therecord’s {sequence, random} etc.). Any tips on this? TIA.
set theRecord to {sequence:"22th", random:"false"}
theRecord's items
Hi Marc,
unfortunately there is no direct way to refer to keys of a record,
but you can “coerce” a record to a string with a forced error.
Hope it helps
coerce_record_to_string({sequence:"22th", random:"false"})
on coerce_record_to_string(theRecord)
try
return theRecord as string
on error errorMessage
set {TID, text item delimiters} to {text item delimiters, "t make "}
set theRecord to item 2 of text items of errorMessage
set text item delimiters to " into type string."
set theRecord to item 1 of text items of theRecord
set text item delimiters to TID
return theRecord
end try
end coerce_record_to_string