Tutorial 5: Viewing and pivoting a cross tab
This tutorial provides step-by-step instructions for authoring a web page that displays a cross tab and provides controls to the user. The file in this tutorial that contains a cross tab is Sales by Territory.rptdesign.In this task, you open or create a copy of JSAPITemplate.html and edit its contents to open a cross tab Reportlet and display it in Interactive Crosstabs Viewer.
1 Using a code editor, open or create a JSAPITemplate.html file that contains the essential components for any web page that implements the JSAPI.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JSAPI Template</title>
</head>
<body onload="init( )">
<div id="sample">
<script type="text/javascript" language="JavaScript" src="http://127.0.0.1:8700/iportal/jsapi"></script>
<script type="text/javascript" language="JavaScript">
<!-- Insert code here -->
</script>
</div>
</body>
2 Navigate to the following line:
<title>JSAPI Template</title>
In title, change:
JSAPI Template
to:
CrossTab Analyzer Page
3 Navigate to the following line:
<div id="sample">
In id, change:
sample
to:
analyzer
4 Navigate to the empty line after the following line:
<script type="text/javascript" language="JavaScript">
5 Add the following code:
var tabviewer;
function init() {
actuate.load("xtabAnalyzer");
actuate.initialize( "http://127.0.0.1:8700/iportal", null,
"administrator", "", runAnalyzer);
}
function runAnalyzer(){
var tabviewer = new actuate.XTabAnalyzer("analyzer");
tabviewer.setReportName("/Applications/BIRT Sample App
/Crosstab Sample Revenue.rptdesign");
tabviewer.setXTabBookmark("SampleRevenue");
tabviewer.submit();
}
6 Save the file as interactivecrosstab.html.
7 In Internet Explorer, open interactivecrosstab.html.
If you receive a security warning that Internet Explorer has restricted this page from running scripts or ActiveX controls that could access your computer, right-click on the message and select Allow Blocked Content.