2021.1

Table Of Contents
w = w + 20;
results.height( h, true);
results.width( w, true);
this
A Standard script or Post Pagination script that has its scope set to "Each matched element"
(see "Setting the scope of a script" on page874) will be called in a loop over the elements that
match the selector of the script - the results (see "results" on page1427). 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.
Page 1345