2021.1

Table Of Contents
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 page1427 and "Writing your own
scripts" on page867.)
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903.)
record.tables
The next script looks up a value in the first record in a detail table called "detail" and shows or
hides the results depending on that value.
if (record.tables.detail[0].fields.prod_id == "10") {
results.show();
} else {
results.hide();
}
Note that indexes start counting at 0, so tables.detail[0] refers to the first record in the detail
table.
Page 1303