Class actuate.xtabanalyzer.Crosstab
Description
The actuate.xtabanalyzer.Crosstab class represents a cross tab report element.
Constructor
Syntax
actuate.xtabanalyzer.Crosstab( )
Constructs a new cross tab object.
Function summary
Table 45‑3 lists actuate.xtabanalyzer.Crosstab functions.
Table 45‑3 actuate.xtabanalyzer.Crosstab functions
Function
Description
Adds a dimension to the cross tab
Adds a measure to the cross tab
Sets options for the cross tab
Switches measure direction
Clears cross tab filters
drill( )
Drills up or down measure levels, replacing drill and filter conditions
Drills down a measure level, updating drill conditions
Drills up a measure level, updating drill conditions
Edits a measure
Retrieves the cross tab element bookmark
Retrieves table data by column index
Returns the data from a cross tab
Retrieves the HTML DOM object
Retrieves the content of the page the cross tab belongs to
getRow( )
Retrieves table data by row index
Retrieves the report element type
Hides the detail of a specified level
pivot( )
Pivots the cross tab
Removes a dimension from the cross tab
Removes a measure from the cross tab
Reorders a dimension
Reorders a measure
Sets the cross tab’s filters
Sets the cross tab’s sorters
Sets the cross tab’s totals
Shows details to the lower level
submit( )
Applies changes made to the cross tab
addDimension
Syntax
void Crosstab.addDimension(actuate.xtabanalyzer.Dimension dimension)
Adds a dimension to the cross tab object.
Parameter
dimension
actuate.xtabanalyzer.Dimension object. The dimension to add.
Example
This example adds a date-based, multi-level dimension to a cross tab:
function addDimension( ){
// Create a dimension for dates in the first column
var dimension = new actuate.xtabanalyzer.Dimension( );
dimension.setIndex(0);
dimension.setAxisType(actuate.xtabanalyzer.Dimension
.COLUMN_AXIS_TYPE);
dimension.setDimensionName("dates");
 
// Create levels using levels from the data cube.
var level = new actuate.xtabanalyzer.Level( );
level.setLevelName("year");
dimension.addLevel(level);
var level = new actuate.xtabanalyzer.Level( );
level.setLevelName("quarter");
dimension.addLevel(level);
 
// Add the dimension to the cross tab.
crosstab.addDimension(dimension);
crosstab.submit( );
}
addMeasure
Syntax
void Crosstab.addMeasure(actuate.xtabanalyzer.Measure measure, integer options)
Adds a measure to the cross tab object.
Parameters
measure
actuate.xtabanalyzer.Measure object. The measure to add.
options
Integer. The options for the add measure operation. These options distinguish the origin of the function call, which can be from another dialog or directly from the Actuate JavaScript API.
Example
This example adds a measure to a cross tab:
function addMeasure( ){
//Create a measure for revenue organized by date and product line.
var measure = new actuate.xtabanalyzer.Measure( );
measure.setIndex(1);
measure.setMeasureName("Quarter Rate");
measure.setExpression("[revenue]/[revenue_SalesDate
/year_Product/PRODUCTLINE]");
 
// Apply the measure to the cross tab
crosstab.addMeasure(measure);
crosstab.submit( );
}
In this example, the expression set with setExpression( ) is in EasyScript, which is described in Using Actuate BIRT Designer Professional.
applyOptions
Syntax
void Crosstab.applyOptions(string | actuate.xtabanalyzer.Options measureDirection, string rowMirrorStartingLevel, string columnMirrorStartingLevel, string emptyCellValue)
Sets measure direction, empty settings, row mirror starting level, column mirror starting level, and empty cell value.
Parameters
measureDirection
String or actuate.xtabanalyzer.Options object. When measureDirection is a string, measureDirection is set to horizontal or vertical and the other parameters set options individually. When an actuate.xtabanalyzer.Options object is specified, all the options are set using settings from this object and applyOptions ignores all subsequent parameters.
rowMirrorStartingLevel
String. Sets the mirror starting level empty setting for a row.
columnMirrorStartingLevel
String. Sets the mirror starting level empty setting for a column.
emptyCellValue
String. Sets the value of an empty cell.
changeMeasureDirection
Syntax
void Crosstab.changeMeasureDirection( )
Switches the measure direction between horizontal and vertical.
Example
This example changes the measure direction:
function changeMeasureDirection( ){
if( crosstab ){
crosstab.changeMeasureDirection( );
crosstab.submit( );
}
}
clearFilters
Syntax
void Crosstab.clearFilters(actuate.xtabanalyzer.Level level, String filterType)
Clears the filters from a level.
Parameters
level
actuate.xtabanalyzer.Level object. Optional. The level from which to clear the filters. To clear all filters, do not specify a level.
filterType
String. Optional. The filter type. To clear all filter types, do not specify a filter type.
Example
This example clears the filters from the level filterLevel:
function clearLevelFilters( ){
if( crosstab ){
crosstab.clearFilters("filterLevel");
crosstab.submit( );
}
}
drill
Syntax
void Crosstab.drill(actuate.xtabanalyzer.Driller driller)
Drills up or down a dimension level. Removes all drill/filter conditions defined on specified dimension first, then adds new drill/filter conditions.
Parameter
driller
actuate.xtabanalyzer.Driller object. The driller object specifies drill conditions on a dimension.
Example
This example drills to a level within a dimension. Any existing drill conditions are replaced.
function drillToDimension(memberVal){
var driller = new actuate.xtabanalyzer.Driller( );
driller.setAxisType(actuate.xtabanalyzer.Dimension
.ROW_AXIS_TYPE);
driller.addMember(memberVal);
myCrosstab.drill(driller);
myCrosstab.submit( );
}
drillDown
Syntax
void Crosstab.drillDown(actuate.xtabanalyzer.Driller driller)
Drills down a dimension level. This method updates the drill conditions specified in the Driller object and leaves all other conditions in place.
Parameter
driller
actuate.xtabanalyzer.Driller object. A drill condition object.
Example
This example drills down a level within a dimension. Any existing drill conditions are unchanged.
function drillToDimension(memberVal){
var driller = new actuate.xtabanalyzer.Driller( );
driller.setAxisType(actuate.xtabanalyzer.Dimension
.ROW_AXIS_TYPE);
driller.addMember(memberVal);
myCrosstab.drillDown(driller);
myCrosstab.submit( );
}
drillUp
Syntax
void Crosstab.drillUp(actuate.xtabanalyzer.Driller driller)
Drills up a dimension level. This method updates the drill conditions specified in the Driller object and leaves all other conditions in place.
Parameter
driller
A drill condition object.
Example
This example drills up a level within a dimension. Any existing drill conditions are unchanged.
function drillToDimension( ){
var driller = new actuate.xtabanalyzer.Driller( );
driller.setAxisType(actuate.xtabanalyzer.Dimension
.ROW_AXIS_TYPE);
// Add the member list to the Driller. Add the Driller to the
// crosstab.
driller.addMember(memberVal);
myCrosstab.drillUp(driller);
myCrosstab.submit( );
}
editMeasure
Syntax
void Crosstab.editMeasure(actuate.xtabanalyzer.Meaure Measure, integer opts)
Edits a measure in the Computed Measure view.
Parameters
Measure
actuate.xtabanalyzer.Measure object. A measure to change.
opts
Integer. Optional. Options for the editMeasure function. These options distinguish the origin of the function call, which can be from another dialog or directly from the Actuate JavaScript API.
Example
This example edits a measure:
function editComputedMeasure( ){
if( crosstab ){
var measure = new actuate.xtabanalyzer.Measure( );
measure.setMeasureName("measureName");
measure.setExpression("measureExpression");
crosstab.editMeasure(measure);
crosstab.submit( );
}
}
getBookmark
Syntax
string Crosstab.getBookmark( )
Returns the bookmark that is associated with the cross tab element.
Returns
String. The cross tab bookmark.
Example
The following code retrieves the bookmark that is associated with the cross tab object:
function getCrosstabBookmark( ){
var crosstabBookmark = crosstab.getBookmark( );
if( !crosstabBookmark ){
alert( "No cross tab bookmark found!" )
return null;
}
return crosstabBookmark;
}
getColumn
Syntax
string[ ] Crosstab.getColumn(integer columnIndex)
Returns the table data by column index.
Parameter
columnIndex
Integer. The column index, starting with 1.
Returns
String[ ]. The column data as an array of strings. This function returns null when the value of columnIndex is out of range. This function only returns data from the current visible page.
Example
The following code retrieves data from a data column:
function getColumnData(index,value){
var columnData = crosstab.getColumn(index);
if( !columnData ){
alert( "Invalid column index!" )
return null;
}
return columnData[value];
}
getData
Syntax
String[ ] Crosstab.getData(boolean forceReparse)
Returns the data in a cross tab.
Parameter
forceReparse
Boolean. Forces a cache refresh when true.
Returns
String[ ]. The data from the cross tab as an array of strings.
getHtmlDom
Syntax
HTMLElement Crosstab.getHtmlDom( )
Returns the HTML element DOM object.
Returns
HTMLElement. The DOM element containing the cross tab.
Example
The following code retrieves the DOM object and uses the DOM object to retrieve an element within the document:
function getContainer(containerName){
var HTMLDom = crosstab.getHtmlDom( );
var container = HTMLDom.getElementById(containerName);
return container;
}
getPageContent
Syntax
actuate.xtabanalyzer.PageContent Crosstab.getPageContent( )
Returns the page content from the current page to which this cross tab belongs. This function returns the same information as XTabAnalyzer.getCurrentPageContent( ).
Returns
actuate.xtabanalyzer.PageContent. The report content.
Example
This example retrieves the page content:
function retrievePageContent( ){
return crosstab.getPageContent( );
}
getRow
Syntax
string[ ] Crosstab.getRow(integer rowIndex)
Returns table data based on row index.
Parameter
rowIndex
Integer. The row index, starting with 1.
Returns
String[ ]. The row data as an array of string values. This function returns null when the value of rowIndex is out of range. This function only returns data from the current visible page.
Example
The following code retrieves data from a data row:
function getRowData(index,value){
var rowData = crosstab.getRow(index);
if( !rowData ){
alert( "Invalid row index!" )
return null;
}
 
return rowData[value];
}
getType
Syntax
string Crosstab.getType( )
Returns the report element type.
Returns
String containing the value "Crosstab".
hideDetail
Syntax
void Crosstab.hideDetail(string levelName)
Hides details of the specified level.
Parameter
levelName
String. The full name of a dimension level to hide.
Example
This example hides lower level details in a level:
function hideDetail( ){
if(crosstab){
var levelName = "rollLevelName";
crosstab.hideDetail(levelName);
crosstab.submit( );
}
}
pivot
Syntax
void Crosstab.pivot( )
Pivots the cross tab.
Example
This example pivots a cross tab:
function pivot(crosstab){
crosstab.pivot( );
crosstab.submit( );
}
removeDimension
Syntax
void Crosstab.removeDimension(object dimension, integer axisType, integer[ ] levels)
Removes a dimension from the cross tab.
Parameters
dimension
actuate.xtabanalyzer.dimension object, a dimension index, or a dimension name. The dimension to remove.
axisType
Integer. The dimension axis type. Axis type can be one of the following values:
*actuate.xtabanalyzer.Dimension.COLUMN_AXIS_TYPE
*actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE
levels
The levels assigned in the dimension, as an array of actuate.xtabanalyzer.Level objects, a level index array, or a level name array.
Example
This example removes a dimension with several layers. The level names are in a text control named levelNames and are separated by semicolons.
function removeDimension( ){
if(crosstab){
crosstab.removeDimension("dimensionName",null,"levelName";);
crosstab.submit( );
}
}
removeMeasure
Syntax
void Crosstab.removeMeasure(actuate.xtabanalyzer.Measure measure)
void Crosstab.removeMeasure(integer measure)
void Crosstab.removeMeasure(string measure)
Removes a measure from the cross tab.
Parameter
measure
actuate.xtabanalyzer.measure object, index, or name. The measure to remove.
Example
This example removes a measure from a cross tab:
function removeMeasure( ){
crosstab.removeMeasure("measureName");
crosstab.submit( );
}
reorderDimension
Syntax
void Crosstab.reorderDimension(actuate.xtabanalyzer.Dimension dimension, integer axisType, integer newIndex, integer newAxisType)
Reorders a dimension within a cross tab. This function can change a dimension’s index or axis type.
Parameters
dimension
actuate.xtabanalyzer.dimension object, or a dimension index or a dimension name. The dimension to reorder.
axisType
Integer. The dimension axis type. Axis type can be one of the following values:
*actuate.xtabanalyzer.Dimension.COLUMN_AXIS_TYPE
*actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE
newIndex
The new index for the dimension.
newAxisType
The new axis type.
Example
This example changes the index and axis type of a dimension:
function changeDimensionOrder( ){
var dimensionIndex = 5;
var newDimensionIndex = 2;
 
var axisType = actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE;
var newAxisType = actuate.xtabanalyzer.Dimension
.COLUMN_AXIS_TYPE;
crosstab.reorderDimension(dimensionIndex, axisType,
newDimensionIndex, newAxisType);
crosstab.submit( );
}
reorderMeasure
Syntax
void Crosstab.reorderMeasure(actuate.xtabanalyzerMeasure measure,integer newIndex)
void Crosstab.reorderMeasure(integer measure,integer newIndex)
void Crosstab.reorderMeasure(string measure,integer newIndex)
Reorders a measure within a cross tab.
Parameters
measure
actuate.xtabanalyzer.Measure object, or a measure index or a measure name. The measure to reorder.
newIndex
The new index for the measure.
Example
This example reorders a measure:
function changeMeasureOrder( ){
var index = 6;
var newIndex = 3;
crosstab.reorderMeasure(index,newIndex);
crosstab.submit( );
}
setFilters
Syntax
void Crosstab.setFilters(actuate.xtabanalyzer.Filter[ ] filters)
Sets an array of filters for the cross tab.
Parameter
filters
Array of actuate.xtabanalyzer.Filter objects. The filter conditions.
Example
This example creates a Filter object and then places it into the cross tab:
function filterLevel( ){
var levelName = "levelName";
var operator = actuate.xtabanalyzer.Filter.BETWEEN;
var filterValue = "20000;50000";
var filter = new actuate.xtabanalyzer.Filter(levelName,
operator);
filter.setValues(filterValue.split(";"));
crosstab.setFilters(filter);
crosstab.submit( );
}
setSorters
Syntax
void Crosstab.setSorters(actuate.xtabanalyzer.Sorter[ ] sorters)
Sets an array of sorters for the cross tab.
Parameter
sorters
Array of actuate.xtabanalyzer.Sorter objects. The sort settings.
Example
This example creates a sorter and adds it to the cross tab:
function sortLevel( ){
var levelName = "levelName";
var sortAscending = true;
var sorter = new actuate.xtabanalyzer.Sorter(levelName);
sorter.setAscending(sortAscending);
crosstab.setSorters(sorter);
crosstab.submit( );
}
setTotals
Syntax
void Crosstab.setTotals(actuate.xtabanalyzer.GrandTotal[ ] grandTotals, actuate.xtabanalyzer.SubTotal[ ] subTotals)
Sets totals for the cross tab.
Parameters
grandTotals
Array of actuate.xtabanalyzer.GrandTotal objects. Grand totals. To set a subtotal, set this parameter to null.
subTotals
Array of actuate.xtabanalyzer.SubTotal objects. Subtotals.
Example
This example adds a grand total to a cross tab:
function addGrandTotal( ){
var grandTotal = new actuate.xtabanalyzer.GrandTotal( );
grandTotal.setAxisType(
actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE);
 
var total = new actuate.xtabanalyzer.Total( );
total.setMeasureIndex(1);
total.setAggregationFunction("SUM");
total.setEnabled(true);
grandTotal.addTotal(total);
 
crosstab.setTotals(grandTotal);
crosstab.submit( );
}
showDetail
Syntax
void Crosstab.showDetail(string axisType)
Shows a level of detail within a cross tab.
Parameter
axisType
String. The dimension axis type. Axis type can be one of the following values:
*actuate.xtabanalyzer.Dimension.COLUMN_AXIS_TYPE
*actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE
Example
This example uses showDetail to expose extra detail on a level:
function showDetail( ){
var axisType = actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE;
crosstab.showDetail(axisType);
crosstab.submit( );
}
submit
Syntax
void Crosstab.submit(function callback)
Applies the changes made to this element. This is an asynchronous operation.
Parameter
callback
Function. Optional. The function called when submit( ) completes. This function receives the current XTabAnalyzer object as an input parameter.
Example
This example uses submit( ) to confirm changes to the cross tab:
function showDetail(crosstab){
var axisType = actuate.xtabanalyzer.Dimension.ROW_AXIS_TYPE;
crosstab.showDetail(axisType);
crosstab.submit( );
}