Referencing Dashboard Component Data by Cell

InetSoft's dashboard software allows users to create custom analytics dashboards to ensure that complex info is broken down into easy to recognize pieces. View the example below to learn more about the Style Intelligence solution.

For Table, Crosstab, and Selection List components, expression scripts can acquire actual data values from the component using relative or absolute references.

#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

The keywords below allow you to access cells within a table or Selection List by using relative indexing (i.e., reference in relation to current cell).

Syntax Description

field['col_name']

Value in the current row of column named “col_name.”

row

Row index of the current cell.

col

Column index of the current cell.

data[rowIx][colIx]

Value of the data at index [rowIx,colIx] in the raw data (before grouping or summarization). Indices may use keywords 'row' and 'col' to create relative references.

table[rowIx][colIx]

Value of the data at [rowIx,colIx] in the table (as displayed). Indices may use keywords 'row' and 'col' to create relative references.

value

Value of the current cell.

You can type these keywords manually into your script, or you can click the appropriate node on the 'Component' tree in the Script Editor.

Conditional Text Formatting

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 '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.

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.

view gallery
View live interactive examples in InetSoft's dashboard and visualization gallery.

Previous: Accessing Dashboard Input