About the BIRT Data Analyzer JavaScript API
The Data Analyzer portion of the Actuate JavaScript API is a set of JavaScript classes that modify, analyze, and display data within cross tab elements. These classes are available to users of BIRT iServer. The Actuate JavaScript API functions that are described in this chapter invoke and control the Data Analyzer viewer and elements that are associated with the viewer. The Data Analyzer JavaScript can be placed within a web page or any other location where the Actuate JavaScript API interfaces with a cross tab.
The actuate.xtabAnalyzer class represents the Data Analyzer viewer that contains cross tab information. Load the analyzer with actuate.load( ).
actuate.load("xtabAnalyzer");
Load support for dialog boxes from the Actuate JavaScript API with actuate.load( ), as shown in the following code:
actuate.load("dialog");
Load the XTabAnalyzer and dialog components to prepare the actuate.XTabAnalyzer component for use within a web page. Call actuate.XTabAnalyzer functions to create and prepare an analytics cross tab. Call the XTabAnalyzer’s submit( ) function to display an existing cross tab in a specified HTML <div> element on a web page.
Use the following JavaScript code to create an instance of a Data Analyzer viewer:
var ctViewer = new actuate.XTabAnalyzer("cTab");
In this example, cTab is the name value for the <div> element that holds the cross tab content. The web page body must contain a <div> element with an ID value of cTab, as shown in the following code:
<DIV ID="cTab"></DIV>
When no <div> element with the correct ID value exists in the web page body, the Data Analyzer viewer launches in a pop-up window.
To load a cross tab or a data cube, use setReportName( ).
ctViewer.setReportName("/Public/BIRT and BIRT Studio Examples/Crosstab Sample Revenue.rptdocument");
The example code loads a report document that consists of a single data cube and cross tab. The report document can be loaded into the Data Analyzer viewer directly. This sample report document installs with iServer.
To access a cross tab element that is part of a larger report, use the cross tab element’s bookmark after setting the report name. A bookmark is set in a report designer or by an external function. Retrieve a cross tab element with actuate.xtabanalyzer.PageContent.getCrosstabByBookmark( ). For example, the following code retrieves a cross tab with the bookmark SampleRevenue:
var content = ctViewer.getCurrentPageContent( );
var crosstab = content.getCrosstabByBookmark("SampleRevenue");
The code in this example retrieves the current page content and the cross tab element within that page, returning an actuate.xtabanalyzer.Crosstab object. This cross-tab object supports the modification of the cross tab with the functions in the Xtabanalyzer subclasses.
To set the bookmark for a cross tab element, create a bookmark for the element within BIRT Designer Professional or call setXTabBookmark( ), as shown in the following code:
ctViewer.setXTabBookmark("SampleRevenue");
This example code assigns the bookmark SampleRevenue to the cross tab.
The XTabAnalyzer.submit( ) function triggers an AJAX request to display the report with all the asynchronous operations that previous viewer functions have prepared. Call submit( ) as shown in the following code:
ctViewer.submit( );
Upon executing submit( ), the Actuate web application returns the report with the cross tab in the assigned <div> element.

Additional Links:

Copyright Actuate Corporation 2012