1.5

Table Of Contents
chapters = chapters.add(loadhtml('snippets/Chapter' + i +
'.html'));
}
results.replaceWith(chapters);
results
The results object (type: QueryResults) contains the HTML element or set of HTML elements
matched by 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.
Property
Field Type Description
length
Number Number of elements in this result set. Equivalent to calling size().
Functions
The functions below can be called by the results object or by the result set that is returned by a
query, see "query()" on page772.
Page 778