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

Class actuate.xtabanalyzer.GrandTotal

Description

The GrandTotal class specifies a cross tab GrandTotal object.

Constructor

Syntax

actuate.xtabanalyzer.GrandTotal( )

Constructs a new GrandTotal object.

Function summary

Table 5-10 lists actuate.xtabanalyzer.GrandTotal functions.

actuate.xtabanalyzer.GrandTotal.addTotal

Syntax  

void GrandTotal.addTotal(object total)

Adds a total to the cross tab.

Parameters    

total

actuate.xtabanalyzer.total. The total object to add to the cross tab.

Example

This example adds totals to a GrandTotal.

function addTotal(grandTotal){
// The indexStr can be set from a web page or other source as
// necessary.
  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);
    grandTotal.addTotal(total);
  }
}

actuate.xtabanalyzer.GrandTotal.getAxisType

Syntax  

integer GrandTotal.getAxisType( )

Returns the axis type for the total.

Returns

Integer. The following values are legal axis types:

n  
n  

Example

This example retrieves and sets the axis type.

function swapAxis(grandtotal){
  if (grandtotal.getAxisType( ) == actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE){
    grandtotal.setNewAxistType(
    actuate.xtabanalyzer.Dimension.COLUMN_AXIS_TYPE);
  } else {  
    grandtotal.setNewAxistType(
    actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE);
  }
}

actuate.xtabanalyzer.GrandTotal.getTotals

Syntax  

object[ ] GrandTotal.getTotals( )

Returns an array containing the totals.

Returns

Array of total objects.

Example

This example retrieves totals from a GrandTotal object.

var totalsArray = [ ];
function getTotals(grandTotal,totalsArray){
  totalsArray = grandTotal.getTotals( );
}

actuate.xtabanalyzer.GrandTotal.setAxisType

Syntax  

void GrandTotal.setAxisType(integer axisType)

Sets the axis type for the total.

    Parameters

axisType

n  

Example

This example retrieves and sets the axis type.

function swapAxis(grandtotal){
  if (grandtotal.getAxisType( ) == actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE){
    grandtotal.setNewAxistType(
    actuate.xtabanalyzer.Dimension.COLUMN_AXIS_TYPE);
  } else {  
    grandtotal.setNewAxistType(
    actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE);
  }
}

actuate.xtabanalyzer.GrandTotal.setTotals

Syntax  

void GrandTotal.setTotals(actuate.xtabanalyzer.Total[ ] totals)

Sets an array of totals.

    Parameters

totals  

Array of actuate.xtabanalyzer.Total objects to add to the grand total.

Example

This example copies the totals from grandtotal1 into grandtotal2

grandtotal2.setTotals(grandtotal1.getTotals( ));

(c) Copyright Actuate Corporation 2011