2021.2

Table Of Contents
If a script runs once, accessing the detail data and dynamically added rows tends to be bit
complicated, especially when they are nested, since it involves looping over the results and
record objects (see "results" on page1448 and "record" on page1321).
If a script targets (something in) a row that is bound to a detail table, and runs once for each
matched element, the current element is accessible via the this object (see "this" on
page1364) and the current detail record is accessible via this.record.
The advantage of the latter approach is demonstrated in the example below.
Example: Styling a row based on a value in a detail table
Here are two scripts that have the same effect:if in a row, the value of the field Shipped is 1, it
colors the text of that row green.
The first script targets a cell in a Dynamic Table row that is bound to a detail table. The script
has its scope set to "Each matched element", so it can use this (see "this" on page1364) to
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).
Page 912