6.2 Aggregating Data in the Worksheet Data Block
To aggregate data from the Worksheet's Data Block within Viewsheet script, use the following syntax:
aggregateMethod(DataBlockName['ColumnName'])
Note: In general, Data Block operations should be performed in the Worksheet rather than the Viewsheet.
For example, to obtain the sum or average of the Data Block column 'Price', use the following expressions:
var sumPrice = Sum(TopSales['Price'])
var avePrice = Average(TopSales['Price'])
To reference a Data Block that has a space in the name (e.g., “Top Sales”), use the viewsheet keyword as follows:
var avePrice = Average(viewsheet["Top Sales"]['Price'])
See Also
Grouping, in Data Mashup, for information on aggregating data.
Accessing Table Cells in Script, in Data Mashup, for information on referencing Data Blocks.
| << 6.1 Referencing Data in the Worksheet Data Block | © 1996-2013 InetSoft Technology Corporation (v11.5) | 7 Changing Images with Script >> |