2022.1

Table Of Contents
Accessing fields and tables
You can access a specific field value:
l using the field's name: record.fieldName (case sensitive)
l via the fields array, by name: record.fields.fieldname or record.fields['fieldname']
(case insensitive)
If there is no field with the specified name, record.fields.fieldname returns an empty string,
whereas record.fieldname will return undefined (unless there is a table with the same name,
in which case the table is returned).
A detail table can be accessed using its name: record.tableName, or via the tables array.
Either way the table name should be followed by a numeric index for a record in that detail
table.
For example, to access the value of the field "prod_id" in the first record of a detail table called
"detail", you can use:
record.detail[0].fields.prod_id or
record.tables["detail"][0].fields.prod_id or
record.tables.detail[0].fields.prod_id or
record.detail[0].prod_id.
If there is no table (and no field) with the specified name, record.tableName results in
undefined.
In order to loop over records in a detail table you could use a for(... in ...) loop (see "for(... in ...)"
on page802), for example:
var records = record.tables.detail;
for (var i in records) {
var rec = records[i];
...
}
Alternatively you could use an 'Each matched element' script (see "Setting the scope of a
script" on page395).
Yet another way is to create a standard for loop using the table's length property:
Page 835