2022.1

Table Of Contents
match the selector of the script - the results (see "results" on page1509). In such a script, this
is an object of the type QueryResult. It represents the current element in the loop.
Note
The scope of Control Scripts can't be set, because they don't have a selector.
Example
If the selector of a script is p.onlyCanada, and its scope is set to "Each matched element", the
script will be repeated for all paragraphs that have the onlyCanada class; it can access only one
paragraph at a time. The script could use this to manipulate each paragraph, e.g. hide or show
it depending on the value of a data field Country in the current record:
if (record.fields["Country"] == "CANADA") {
this.show();
} else {
this.hide();
}
Note
In a script that has its scope set to "Each matched element", the results object is still
accessible, and can be used in a non-iterative way (for example, you could use its
length property to determine the total number of matched elements) but iterating over
results will produce a warning.
Properties
Field Type Description
id Number Index in the result set, or zero if this element is not part of
a result set.
record
Record Represents the current detail record in a (possibly
nested) detail table associated with repeating rows in a
Dynamic Table. This property is only available when
Page 1426