2022.1

Table Of Contents
Tip
For more examples of using conditions, see this how-to: Combining record-based
conditions.
If an expanded script contains errors or if there are warnings, icons appear in the overview ruler
on the right hand side of the editing area. These icons are shown relative to their position in the
script and do not move as you scroll down. You can click on an icon to quickly jump to the error
or warning. Script errors are highlighted by a red icon, and warnings in yellow. The topmost
icon will display red if any errors exist in the script at all.
Designer API
Features like results and record do not exist in the native JavaScript library. These are
additional JavaScript features, designed for use in Connect scripts only. All features designed
for use in the Designer are listed in the Designer's API, with a lot of examples; see "Standard
Script API" on page1343.
Tip
Do you find yourself copy-pasting the same function into every new script? You can avoid
this by defining your function in a Control Script. Control Scripts are executed first, so the
function will then be available in all Standard Scripts and Post Pagination Scripts.
Setting the scope of a script
The selector of a script can match multiple elements. By setting the scope of the script you can
determine whether you want to run the script once, or once for each element that matches the
selector. The second option is especially useful when a script targets rows or cells in a
Dynamic Table (see "Using scripts in Dynamic Tables" on page951).
To set the scope of a script, click on Options at the bottom of the Script Editor window. The
options are:
l Result set: The script will run once, regardless of the number of elements that match the
selector. It will have access to all elements that match the selector via the results
object (see "results" on page1509). The each() function could be used to iterate over
Page 924