2020.2

Table Of Contents
Field Type Description
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.tables["detail"][0].fields.prod_id or
record.tables.detail[0].fields.prod_id.
In order to loop over the records in this table you could use the
table's length property (e.g. record.tables.detail.length),
or use for(... in ...) (see "for(... in ...)" on page1272) or an 'Each
matched element' script (see "Setting the scope of a script" on
page860).
Examples
record.fields
The following Standard Script evaluates the data field Country in the current record. If the value
is 'CANADA' it will show the results, otherwise it will hide them. (The results object contains the
elements that match the script's selector; see "results" on page1420 and "Writing your own
scripts" on page853.)
if (record.fields["Country"] == "CANADA") {
results.show();
} else {
results.hide();
}
In a Control Script, an entire section could be enabled or disabled based on the same
condition:
if (record.fields["Country"] == "CANADA") {
merge.template.contexts.PRINT.sections["Section 1"].enabled =
true;
} else {
merge.template.contexts.PRINT.sections["Section 1"].enabled =
false;
}
(For more information about Control Scripts, see "Control Scripts" on page890.)
Page 1296