BIRT Data Analyzer API classes : Class actuate.xtabanalyzer.Total

Class actuate.xtabanalyzer.Total

Description

A container for the Total in the xtabanalyzer.

Constructor

Syntax

actuate.xtabanalyzer.Total( )

The Total class is used to specify a cross tab total object.

Function summary

Table 5-19 lists actuate.xtabanalyzer.Total functions.

actuate.xtabanalyzer.Total.getAggregationFunction

Syntax  

string Total.getAggregationFunction( )

Returns the aggregation function for the total.

Example

This example changes the aggregation function.

function swapTotalAggregation(total){
  if (total.getAggregationFunction( ) == "SUM"){
    total.setAggregationFunction("COUNT");
  } else {
    total.setAggregationFunction("SUM");
  }
}

actuate.xtabanalyzer.Total.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;
}

actuate.xtabanalyzer.Total.isEnabled

Syntax

boolean Total.isEnabled( )

Returns a flag indicating if the total is enabled.

Returns

Boolean.

Example

This example enables and disables a total.

if (total){
  if (total.isEnabled){
    total.setEnabled(false);
  } else {
    total.setEnabled(true);
  }
}

actuate.xtabanalyzer.Total.setAggregationFunction

Syntax  

void Total.setAggregationFunction(string aggregationFunction)

Sets the aggregation function name.

Parameters

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");
  }
}

actuate.xtabanalyzer.Total.setEnabled

Syntax

void Total.setEnabled(boolean enabled)

Sets whether total is enabled or disabled.

Parameters  

enabled

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);
  }
}

actuate.xtabanalyzer.Total.setMeasureIndex

Syntax  

void Total.setMeasureIndex(integer measureIndex)

Sets the measure index for the total.

Parameters

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( );
}

(c) Copyright Actuate Corporation 2011