3.6.1 Accessing Table Data

There are two key properties for accessing the values in a table, table and data.

table – A two-dimensional array containing the table data as displayed. The array includes header rows as well as data rows.

data – A two dimensional array containing the raw table data (prior to grouping and summarization). It does not include header rows.

Two sub-properties that are especially useful when looping through the rows or columns of tables are 'length' and 'size'.

Note: A table that returns no data still displays the column header row. Therefore, table.length is 1 in the no-data case.

table.length/table.size – The number of rows and columns (respectively) in the table, as displayed, including column header row.

data.length/data.size – The number of rows and columns (respectively) in the original table (prior to grouping and summarization), including column header row.

As an example, consider the following table script, which iterates through all data rows (beginning with row index 1, the first data row) and columns of a table, and cumulatively sums these values.

var tot = 0;

for(var row = 1; row < table.length; row++) {

   for(var col = 0; col < table.size; col++) {

      tot = tot + table[row][col];

   }

}

The data attribute can also be accessed using formula table syntax, for example:

data['Total@Company:$Company?inGroups(["Company",Company])']

See Formula Tables for more information on this syntax.

<< 3.6 Data Tables © 1996-2013 InetSoft Technology Corporation (v11.4) 3.6.2 Setting Cell and Row Visual Properties >>