adding to records

if I have the following record:


set myRecord to {export file type:"JPEG 2000", export compression quality:lossless}

and I want to add an extra element to it, the only way I have found to make this work is:


set myRecord to myRecord & {export target data size:50000}

I would like to be able to do something similar to what you can do with lists, for example:


set end of myRecord to {export target data size:50000}

Any suggestions.
TIA

The way you found is the way to do it, namely to concatenate a record containing what you want to the record you already have. You can’t set the end of a record because the items aren’t officially in any order. When you set the end of a list to another list, the result is a list within a list. You have to concatenate the lists if you want a combination of the two. It’s the same with records.

When you concatenate two records, say:

set newRecord to record1 & record2

… the result will consist of all the fields and values from record1 plus any fields and values from record2 that are not in record1. If the two records have fields in common, only one instance of each field will appear in the result and this fields will have the value from record1.

set newRecord to {a:"Fred", b:17, c:true} & {b:"Aardvark", d:missing value}
--> {a:"Fred", b:17, c:true, d:missing value}