2018.2

Table Of Contents
(For more information about Control Scripts, see "Control Scripts" on page751.)
The next script looks up a value in the first record in a detail table 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.
results
The results object (type: QueryResults) is the result of the query for HTML elements that match
the selector of the script. The selector of a script can be specified in the Script Editor and is
visible in the second column of the Scripts pane, next to the name of the script.
If, for example, a script would have the selector p.onlyCanada, the script would apply to all
paragraphs that have the class onlyCanada. (Classes can be defined in the Attributes pane at
the right: select the element in the content and type the class(es) in the Class field.)
The script could then use the results object to hide or show those paragraphs, depending on
the value of the data field Country in the current record:
if (record.fields["Country"] == "CANADA") {
results.show();
} else {
results.hide();
}
Note
This object can't be used in Control Scripts, because they don't have a selector.
Page 1105