5.3 Accessing Data With Absolute/Mixed References
The following expressions allow you to access any cell in a table by absolute reference.
table[rowIx][colIx]
data[rowIx][colIx]
Simply set the rowIx and colIx indexes to specify the position of the desired cell. For example:
• table[0][0]: Value in first row, first column.
• table[2][4]: Value in third row, fifth column.
The “table.length” property yields the total number of rows in the table. The data and table constructs yield the same results for tables, but may produce different results when used in crosstab tables. The data syntax references the data prior to any summarization, while the table syntax references the tabular data as displayed.
You can type these keywords manually into your script, or you can click the appropriate node on the 'Component' tree in the Script Editor.

You can use absolute and relative references in the same statement, as the following example illustrates.
This example continues from Accessing Data in Different Row or Column ('row'/'col'). It will set the header cell of the 'Price' column to show a red background if there exists a price exceeding $2000, and will otherwise show a green background. This requires a loop structure, as well as mixed absolute and relative references:
1. Select the header cell in the 'Price' column. Right-click and choose 'Format'.

2. Select the Color tab. From the 'Fill Color' menu select the 'Expression' option, and click the 'Edit' button. This opens the Formula Editor.
3. Add the following script in the Formula Editor.
for (i=1; i<table.length; i++) {
if (table[i][col] > 2000) {
[255,0,0];
break;
}
else {
[0,255,0];
}
}
4. Click 'OK' to exit the Formula Editor, and then click 'OK' to exit the 'Format' dialog box.

The header cell is red because a price exists that exceeds $2000. To test the header cell script, add a Range Slider to filter the values in the table. Follow these steps:
5. Drag a Range Slider from the Component tree into the Viewsheet. This creates a new Range Slider.
6. From the 'ProductInfo' Data Block in the Component tree, drag the 'Price' field onto the Range Slider. This binds the Range Slider to the 'Price' field.

7. Drag the right side of the Range Slider to vary the prices included in the dataset. Observe the color of the header cell as the dataset changes.
See Also
Accessing Data With Relative References, for information on relative references.
| << 5.2.3 Accessing Data in Different Row or Column ('row'/'col') | © 1996-2013 InetSoft Technology Corporation (v11.5) | 5.4 Accessing User-Modified Data in a Table >> |