Class actuate.xtabanalyzer.SubTotal
Description
A SubTotal object.
Constructor
Syntax
actuate.xtabanalyzer.SubTotal( )
Constructs a new SubTotal object.
Function summary
Table 45‑19 lists actuate.xtabanalyzer.SubTotal functions.
Table 45‑19 actuate.xtabanalyzer.SubTotal functions 
Function
Description
Add a total
Returns the full level name
Returns the location
Returns the totals array
Returns the type string
Sets the full level name
Sets the location
Sets the totals array
addTotal
Syntax
void SubTotal.addTotal(actuate.xtabanalyzer.Total total)
Adds a total to the subtotal.
Parameter
total
actuate.xtabanalyzer.Total. The total object being added.
Example
This example uses addTotal( ) 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 measureIndexs = [ ];
for(var i = 0;i < indexs.length;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( );
}
getLevelName
Syntax
string SubTotal.getLevelName( )
Returns the level for the subtotal.
Returns
String. The level name for the subtotal.
Example
This example retrieves the level name from the subtotal:
function getLevelName(subTotal){
if (subTotal){
return subTotal.getLevelName( );
}
return null;
}
getLocation
Syntax
string SubTotal.getLocation( )
Returns the location name for the subtotal.
Returns
String. The location name.
Example
This example retrieves the level name from the subtotal:
function getLocation(subTotal){
if (subTotal){
return subTotal.getLocation( );
}
return null;
}
getTotals
Syntax
object[ ] SubTotal.getTotals( )
Returns the totals used to calculate the subtotal.
Returns
actuate.xtabanalyzer.Total[ ]. An array of total objects.
Example
This example retrieves the totals from a SubTotal object:
var totalsArray = [ ];
function getTotals(subTotal,totalsArray){
totalsArray = subTotal.getTotals( );
}
getType
Syntax
string SubTotal.getType( )
Returns the type for the subtotal.
Returns
String. The type for the subtotal.
Example
This example retrieves the type from the subtotal:
function getLevelName(subTotal){
if (subTotal){
return subTotal.getType( );
}
return null;
}
setLevelName
Syntax
void SubTotal.setLevelName(string levelName)
Sets the level for the subtotal by name.
Parameter
levelName
String. The level name.
Example
This example sets the level name for a subtotal:
function subTotalLevel(subTotal,levelName){
if(subTotal){
subTotal.setLevelName(levelName);
}
}
setLocation
Syntax
void SubTotal.setLocation(string location)
Sets the location for the subtotal.
Parameter
location
String. The location. Value can be either before or after.
Example
This example sets the location for a subtotal:
function subTotalLocation(subTotal,location){
if(subTotal){
subTotal.setLocation(location);
}
}
setTotals
Syntax
void SubTotal.setTotals(actuate.xtabanalyzer.Total[ ] totals)
Sets the totals using an array.
Parameter
totals
Array of actuate.xtabanalyzer.Total objects to add to the subtotal.
Example
This example uses setTotals( ) 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]));
}
var totals = Array(count);
for( var i = 0; i < measureIndexs.length; i++){
var total = new actuate.xtabanalyzer.Total( );
total.setMeasureIndex( measureIndexs[i] );
total.setAggregationFunction( "SUM" );
total.setEnabled(true);
totals[i] = total;
}
subTotal.setTotals(totals);
crosstab.setTotals( null, subTotal );
crosstab.submit( );
}