2022.1

Table Of Contents
access the selected cell and this.record to access the current detail record, without
performing any loops.
Selector: table [data-script='Shipped'].
Scope: Each matched element
var field = this.record.fields['Shipped'];
if (field) {
this.text(formatter.upperCase(field));
if (field == 1)
this.parent().css('color', 'green');
}
The following script targets the table, and has its scope set to "Result set". This script loops
over the detail table in the record, evaluating the field Shipped. If the value of that field is 1, it
looks up the corresponding row in the results (the selected Dynamic Table).
Selector: #table_1 tbody
Scope: Result set
for(var i = 0; i < record.tables.detail.length; i++){
if(record.tables.detail[i].fields['Shipped'] == 1)
query("tr:nth-child(" + (i+1) + ")", results).css
('color','green');
}
Control Scripts
When output is generated from a template, Control Scripts run before all other scripts, when a
record is merged with a context. They determine how different sections of the context are
handled. They can, for example, make the page numbering continue over all Print sections,
split Email attachments, or omit Print sections from the output.
Some knowledge of JavaScript is needed to edit Control Scripts, just as for any other self-made
scripts; see "Writing your own scripts" on page918. Some functionality is provided as a
Scripting Wizard, for example Conditional Print Sections.
This topic explains how to add a Control Script and it gives an overview of what Control Scripts
can do. It will also tell you where you will find information about each feature, including
examples.
Page 954