5.2.1 Accessing Data in the Current Cell ('value')
The value keyword refers to the value in the current cell. The value keyword is the equivalent of the index expression table[row][col].
Walkthrough
This example sets the text colors and fill colors of table cells based on data values within the table. If a price is greater than $1000, the price displays in red text, otherwise, in blue text.
1. Create a Viewsheet based on the 'Tutorial' > 'ProductSales' Data Worksheet.
2. Drag and drop the 'ProductInfo' Data Block from the Component pane into the Viewsheet. Expand the table so that you can see more rows.
3. Select any data cell under the 'Price' column. Right-click and choose the 'Format' option. This opens the 'Format' dialog box.

4. Select the Color tab.

5. From the 'Text Color' menu select the 'Expression' option, and click the 'Edit' button. This opens the Formula Editor.

6. Enter the following script in the Formula Editor:
if (value > 1000) {
[255,0,0]; // red
} else {
0x0000FF; // blue
}
Note: A color can be specified as an ordered triple, or as a hexadecimal number.
7. Click 'OK' to exit the Formula Editor, and then click 'OK' to exit the 'Format' dialog box.
Note: You can apply conditional formatting without using script. See Highlights in the Dashboard Design.

Notice that the cells in the 'Price' column are colored red if the value is greater than 1000 and blue otherwise. The script affects the entire 'Price' column, and can be edited from the 'Format' dialog box of any cell in the column. This example continues in Accessing Data in the Same Row ('field').
See Also
value, for reference information.
| << 5.2 Accessing Data With Relative References | © 1996-2013 InetSoft Technology Corporation (v11.4) | 5.2.2 Accessing Data in the Same Row ('field') >> |