3.9.1 Accessing Data
When you bind a Section to a data source (i.e., to generate a pseudo-table), each band of the Section is repeated multiple times, corresponding to the number of rows returned by the query. For example, the Content band of the Section is repeated once for each detail record returned by the query.
If you place a script on a component within a repeating band, this script is re-executed for every band repetition. This has the effect of wrapping the script in an implicit “for” loop. Within the script, you can reference the values of elements in the same band:
• value – the value (in current band iteration) of the element to which the script is attached.
Use auto-complete to enter the correct syntax.
• field['column_name'] or field.column_name – the value (in current band iteration) of the element in the specified field.
You can also refer to an element in the band by its Element ID (e.g., “Text1.text”) to obtain the current value. To obtain the row number corresponding to the current band iteration, use the sectionRow property.
In the following example, you will read the value of an element in a Section, and use that value to conditionally hide or show another element. Follow the steps below:
1. Create a new report, and add a Section element. Bind the Section to the 'All Sales' query.
2. Right-click the Text element in the 'Total' column content band (detail row), and select 'Script'. This opens the Script Editor to edit the Text element.

3. Enter the following script for the Text element.
if (field.Employee != 'Annie') {
visible=false
}
else {
visible=true
}
The if/else statement checks the value of the 'Employee' field, and hides the current 'Total' element if the employee is other than Annie.
In this example, you may note that the “else” block of the “if/else” statement is not strictly required. However, when you use the above method to set visual properties of the Section, you will need to include the “else” block to obtain the desired results. See Setting Visual Properties for an example.
| << 3.9 Sections | © 1996-2013 InetSoft Technology Corporation (v11.4) | 3.9.2 Setting Visual Properties >> |