Working with totals
Each dimension within a cross tab and each level within a multilevel dimension can have a total associated with that dimension or level. A row or column with a single dimension can only have a grand total. Each level in a multilevel dimension can have a subtotal. Subtotals are only available for multilevel dimensions.
A total requires a measure and an aggregation function. To add a grand total to a measure, use the actuate.xtabanalyzer.GrandTotal class. Subtotals are added with the actuate.xtabanalyzer.SubTotal class. Both classes use the actuate.xtabanalyzer.Total class. The Total class supports creating aggregated values on a measure, calculated on either a row or a column. This example creates a total and places the SUM aggregation function on the measure located at measure index 0:
var grandTotal = new actuate.xtabanalyzer.GrandTotal( );
grandTotal.setAxisType(actuate.xtabanalyzer.Dimension
.ROW_AXIS_TYPE );
// Create a total object containing a measure and aggregation.
var total = new actuate.xtabanalyzer.Total( );
total.setMeasureIndex(0);
total.setAggregationFunction("SUM");
total.setEnabled(true);
 
// Add the total to the cross tab.
grandTotal.addTotal(total);
crosstab.setTotals(grandTotal);
crosstab.submit( );
The actuate.xtabanalyzer.Total class uses a measure index and an aggregation function to create a Total object that is added to a SubTotal or GrandTotal object for placement within the cross tab. A total must be enabled for that total to be active on the cross tab.
To remove a total from a cross tab, use setEnabled( ) and pass false as a parameter, as shown in the following code:
total.setEnabled(false);
grandTotal.addTotal(total);
crosstab.setTotals(grandTotal);
crosstab.submit( );