Class actuate.xtabanalyzer.Total
Description
A container for a total in the xtabanalyzer. Total handles numeric aggregation functions for a measure.
Constructor
Syntax
actuate.xtabanalyzer.Total( )
The Total class is used to specify a cross tab total object.
Function summary
Table 15‑20 lists actuate.xtabanalyzer.Total functions.
Table 15‑20 actuate.xtabanalyzer.Total functions
Function | Description |
| Returns the aggregation function name |
| Returns the measure index |
| Returns whether or not the total is enabled |
| Sets the aggregation function name |
| Sets the enabled flag |
| Sets the index for the total |
getAggregationFunction
Syntax
string Total.getAggregationFunction( )
Returns the aggregation function for the total.
Returns
String. An aggregation function.
Example
This example changes the aggregation function:
function swapTotalAggregation(total){
if (total.getAggregationFunction( ) == "SUM"){
total.setAggregationFunction("COUNT");
} else {
total.setAggregationFunction("SUM");
}
}
getMeasureIndex
Syntax
integer Dimension.getMeasureIndex( )
Retrieves the measure index for the total.
Returns
Integer. The measure index.
Example
This example retrieves the measure index:
function getMeasureIndex(total){
if (total){
return total.getIndex( );
}
return null;
}
isEnabled
Syntax
boolean Total.isEnabled( )
Returns whether the total is enabled.
Returns
Boolean. True indicates this total is enabled.
Example
This example enables and disables a total:
if (total){
if (total.isEnabled){
total.setEnabled(false);
} else {
total.setEnabled(true);
}
}
setAggregationFunction
Syntax
void Total.setAggregationFunction(string aggregationFunction)
Sets the aggregation function name.
Parameter
aggregationFunction
String. The aggregation function name.
Example
This example changes the aggregation function:
function swapTotalAggregation(total){
if (total.getAggregationFunction( ) == "SUM"){
total.setAggregationFunction("COUNT");
} else {
total.setAggregationFunction("SUM");
}
}
setEnabled
Syntax
void Total.setEnabled(boolean enabled)
Sets whether total is enabled or disabled.
Parameter
enabled
Boolean. True if the total is enabled. False for disabled.
Example
This example enables and disables a total:
if (total){
if (total.isEnabled){
total.setEnabled(false);
} else {
total.setEnabled(true);
}
}
setMeasureIndex
Syntax
void Total.setMeasureIndex(integer measureIndex)
Sets the measure index for the total.
Parameter
measureIndex
Integer. The measure index for the total.
Example
This example uses setMeasureIndex( ) to create a subtotal:
function addSubTotal( ){
var subTotal = new actuate.xtabanalyzer.SubTotal( );
subTotal.setLevelName("year");
subTotal.setLocation("after");
var indexStr = "0;1;2;3;4";
var indexs = indexsStr.split(";");
var count = indexs.length;
var measureIndexs = [];
for(var i = 0;i < count;i++){
measureIndexs.push(parseInt(indexs[i]));
}
for( var i = 0; i < measureIndexs.length; i++) {
var total = new actuate.xtabanalyzer.Total( );
total.setMeasureIndex(measureIndexs[i]);
total.setAggregationFunction("SUM");
total.setEnabled(true);
subTotal.addTotal(total);
}
crosstab.setTotals(null,subTotal);
crosstab.submit( );
}