Using Actuate JavaScript API Information in this document is subject to change without notice. Examples provided are fictitious. No part of this document may be reproduced or transmitted in any form, or by any means, electronic or mechanical, for any purpose, in whole or in part, without the express written permission of Actuate Corporation.
© 1995 - 2012 by Actuate Corporation. All rights reserved. Printed in the United States of America.
Contains information proprietary to: Actuate Corporation, 951 Mariners Island Boulevard, San Mateo, CA 94404 www.actuate.com www.birt-exchange.com
The software described in this manual is provided by Actuate Corporation under an Actuate License agreement. The software may be used only in accordance with the terms of the agreement. Actuate software products are protected by U.S. and International patents and patents pending. For a current list of patents, please see http://www.actuate.com/patents.
Actuate Corporation trademarks and registered trademarks include: Actuate, ActuateOne, the Actuate logo, Archived Data Analytics, BIRT, BIRT 360, BIRT Data Analyzer, BIRT Performance Analytics, Collaborative Reporting Architecture, e.Analysis, e.Report, e.Reporting, e.Spreadsheet, Encyclopedia, Interactive Viewing, OnPerformance, Performancesoft, Performancesoft Track, Performancesoft Views, Report Encyclopedia, Reportlet, The people behind BIRT, X2BIRT, and XML reports.
Actuate products may contain third-party products or technologies. Third-party trademarks or registered trademarks of their respective owners, companies, or organizations include:
Mark Adler and Jean-loup Gailly (www.zlib.net): zLib. Adobe Systems Incorporated: Flash Player. Apache Software Foundation (www.apache.org): Axis, Axis2, Batik, Batik SVG library, Commons Command Line Interface (CLI), Commons Codec, Derby, Hive driver for Hadoop, Shindig, Struts, Tomcat, Xalan, Xerces, Xerces2 Java Parser, and Xerces-C++ XML Parser. Castor (www.castor.org), ExoLab Project (www.exolab.org), and Intalio, Inc. (www.intalio.org): Castor. Codejock Software: Xtreme Toolkit Pro. Eclipse Foundation, Inc. (www.eclipse.org): Babel, Data Tools Platform (DTP) ODA, Eclipse SDK, Graphics Editor Framework (GEF), Eclipse Modeling Framework (EMF), and Eclipse Web Tools Platform (WTP), licensed under the Eclipse Public License (EPL). Bits Per Second, Ltd. and Graphics Server Technologies, L.P.: Graphics Server. Gargoyle Software Inc.: HtmlUnit, licensed under Apache License Version 2.0. GNU Project: GNU Regular Expression, licensed under the GNU Lesser General Public License (LGPLv3). HighSlide: HighCharts. IDAutomation.com, Inc.: IDAutomation. Jason Hsueth and Kenton Varda (code.google.com): Protocole Buffer. IDRsolutions Ltd.: JBIG2, licensed under the BSD license. ImageMagick Studio LLC.: ImageMagick. InfoSoft Global (P) Ltd.: FusionCharts, FusionMaps, FusionWidgets, PowerCharts. Matt Inger (sourceforge.net): Ant-Contrib, licensed under Apache License Version 2.0. Matt Ingenthron, Eric D. Lambert, and Dustin Sallings (code.google.com): Spymemcached, licensed under the MIT OSI License. International Components for Unicode (ICU): ICU library. jQuery: jQuery, licensed under the MIT License. Yuri Kanivets (code.google.com): Android Wheel gadget, licensed under the Apache Public License (APL). KL Group, Inc.: XRT Graph, licensed under XRT for Motif Binary License Agreement. LEAD Technologies, Inc.: LEADTOOLS. Bruno Lowagie and Paulo Soares: iText, licensed under the Mozilla Public License (MPL). Microsoft Corporation (Microsoft Developer Network): CompoundDocument Library. Mozilla: Mozilla XML Parser, licensed under the Mozilla Public License (MPL). MySQL Americas, Inc.: MySQL Connector. Netscape Communications Corporation, Inc.: Rhino, licensed under the Netscape Public License (NPL). OOPS Consultancy: XMLTask, licensed under the Apache License, Version 2.0. Oracle Corporation: Berkeley DB, Java Advanced Imaging, JAXB, JDK, Jstl. PostgreSQL Global Development Group: pgAdmin, PostgreSQL, PostgreSQL JDBC driver. Progress Software Corporation: DataDirect Connect XE for JDBC Salesforce, DataDirect JDBC, DataDirect ODBC. Rogue Wave Software, Inc.: Rogue Wave Library SourcePro Core, tools.h++. Sam Stephenson (prototype.conio.net): prototype.js, licensed under the MIT license. Sencha Inc.: Ext JS. ThimbleWare, Inc.: JMemcached, licensed under the Apache Public License (APL). World Wide Web Consortium (W3C)(MIT, ERCIM, Keio): Flute, JTidy, Simple API for CSS. XFree86 Project, Inc.: (www.xfree86.org): xvfb. ZXing authors (code.google.com): ZXing, licensed under the Apache Public License (APL).
All other brand or product names are trademarks or registered trademarks of their respective owners, companies, or organizations. Document No. 120201-2-791301 August 2, 2012 Contents
About Using Actuate JavaScript API...... v Chapter 1 Creating a custom web page using the Actuate JavaScript API ...... 1 About the Actuate JavaScript API ...... 2 Accessing the Actuate JavaScript API ...... 2 About the DOCTYPE tag ...... 3 About UTF8 character encoding ...... 3 Establishing an HTTP session with an Actuate web application ...... 4 About Actuate JavaScript API security integration ...... 4 Establishing a secure connection to more than one web service ...... 5 Using a login servlet to connect to an Actuate web application ...... 6 Using a custom servlet to connect to an Actuate web application ...... 7 Unloading authentication information from the session ...... 7 Viewing reports ...... 8 Controlling viewer user interface features ...... 10 Accessing report content ...... 10 Using a filter ...... 11 Using a sorter ...... 11 Navigating repository content using ReportExplorer ...... 12 Displaying ReportExplorer ...... 12 Opening files from ReportExplorer ...... 14 Using dashboards and gadgets ...... 17 Using and submitting report parameters ...... 18 Using a parameter component ...... 19 Accessing parameter values from the Viewer ...... 20 Retrieving report content as data ...... 22 Using a data service component ...... 22 Using a result set component ...... 23 Chapter 2 Creating dynamic report content using the Actuate JavaScript API . . . . 25 About Actuate JavaScript API scripting in a BIRT Report Design ...... 26 Using the Actuate JavaScript API in an HTML button ...... 27 Using the Actuate JavaScript API in chart interactive features ...... 28 Using the Actuate JavaScript API in chart themes ...... 32 Using the Actuate JavaScript API in the BIRT script editor ...... 33 Chapter 3 Working with BIRT Data Analyzer and cross tabs ...... 35
i About cross tabs ...... 36 About cubes ...... 37 Handling Data Analyzer viewer events ...... 38 Working with dimensions, measures, and levels ...... 39 Adding a dimension with levels ...... 39 Removing a dimension ...... 40 Adding and removing measures ...... 40 Changing measures and dimensions ...... 41 Working with totals ...... 42 Sorting and filtering cross-tab data ...... 43 Drilling down within a cross tab ...... 43 Controlling the Data Analyzer viewer user interface ...... 44 Chapter 4 Actuate JavaScript API classes ...... 47 Actuate JavaScript API overview ...... 48 About the actuate namespace ...... 48 Using the Actuate library ...... 48 Actuate JavaScript API classes quick reference ...... 49 Actuate JavaScript API reference ...... 51 Class actuate ...... 52 Class actuate.AuthenticationException ...... 59 Class actuate.ConnectionException ...... 61 Class actuate.Dashboard ...... 62 Class actuate.dashboard.DashboardDefinition ...... 72 Class actuate.dashboard.EventConstants ...... 73 Class actuate.dashboard.GadgetScript ...... 74 Class actuate.dashboard.Tab ...... 77 Class actuate.data.Filter ...... 79 Class actuate.data.ReportContent ...... 84 Class actuate.data.Request ...... 85 Class actuate.data.ResultSet ...... 90 Class actuate.data.Sorter ...... 92 Class actuate.DataService ...... 95 Class actuate.Exception ...... 97 Class actuate.Parameter ...... 100 Class actuate.parameter.Constants ...... 111 Class actuate.parameter.ConvertUtility ...... 112 Class actuate.parameter.EventConstants ...... 115 Class actuate.parameter.NameValuePair ...... 116 Class actuate.parameter.ParameterData ...... 118 Class actuate.parameter.ParameterDefinition ...... 126 Class actuate.parameter.ParameterValue ...... 143
ii Class actuate.report.Chart ...... 151 Class actuate.report.DataItem ...... 159 Class actuate.report.FlashObject ...... 163 Class actuate.report.Gadget ...... 167 Class actuate.report.HTML5Chart.ClientChart ...... 172 Class actuate.report.HTML5Chart.ClientOption ...... 179 Class actuate.report.HTML5Chart.ClientPoint ...... 183 Class actuate.report.HTML5Chart.ClientSeries ...... 186 Class actuate.report.HTML5Chart.Highcharts ...... 191 Class actuate.report.HTML5Chart.Renderer ...... 192 Class actuate.report.Label ...... 198 Class actuate.report.Table ...... 202 Class actuate.report.TextItem ...... 210 Class actuate.ReportExplorer ...... 214 Class actuate.reportexplorer.Constants ...... 221 Class actuate.reportexplorer.EventConstants ...... 222 Class actuate.reportexplorer.File ...... 223 Class actuate.reportexplorer.FileCondition ...... 231 Class actuate.reportexplorer.FileSearch ...... 233 Class actuate.reportexplorer.FolderItems ...... 242 Class actuate.reportexplorer.PrivilegeFilter ...... 244 Class actuate.RequestOptions ...... 248 Class actuate.Viewer ...... 252 Class actuate.viewer.BrowserPanel ...... 272 Class actuate.viewer.EventConstants ...... 273 Class actuate.viewer.PageContent ...... 274 Class actuate.viewer.ParameterValue ...... 278 Class actuate.viewer.RenderOptions ...... 280 Class actuate.viewer.ScrollPanel ...... 282 Class actuate.viewer.SelectedContent ...... 285 Class actuate.viewer.UIConfig ...... 287 Class actuate.viewer.UIOptions ...... 289 Class actuate.viewer.ViewerException ...... 303 Chapter 5 BIRT Data Analyzer API classes ...... 305 About the BIRT Data Analyzer JavaScript API ...... 306 Data Analyzer API reference ...... 307 Data Analyzer JavaScript classes quick reference ...... 309 Class actuate.XTabAnalyzer ...... 310 Class actuate.xtabanalyzer.Crosstab ...... 327 Class actuate.xtabanalyzer.Dimension ...... 341 Class actuate.xtabanalyzer.Driller ...... 347
iii Class actuate.xtabanalyzer.EventConstants ...... 350 Class actuate.xtabanalyzer.Exception ...... 351 Class actuate.xtabanalyzer.Filter ...... 354 Class actuate.xtabanalyzer.GrandTotal ...... 361 Class actuate.xtabanalyzer.Level ...... 364 Class actuate.xtabanalyzer.LevelAttribute ...... 367 Class actuate.xtabanalyzer.Measure ...... 368 Class actuate.xtabanalyzer.MemberValue ...... 373 Class actuate.xtabanalyzer.Options ...... 376 Class actuate.xtabanalyzer.PageContent ...... 383 Class actuate.xtabanalyzer.ParameterValue ...... 385 Class actuate.xtabanalyzer.Sorter ...... 388 Class actuate.xtabanalyzer.SubTotal ...... 392 Class actuate.xtabanalyzer.Total ...... 396 Class actuate.xtabanalyzer.UIOptions ...... 399 Index ...... 403
iv About Using Actuate JavaScript API
Using Actuate JavaScript API is a guide to designing custom reporting web applications with the Actuate JavaScript API. Using Actuate JavaScript API includes the following chapters: ■ About Using Actuate JavaScript API. This chapter provides an overview of this guide. ■ Chapter 1. Creating a custom web page using the Actuate JavaScript API. This chapter describes the Actuate JavaScript API requirements and common implementations. ■ Chapter 2. Creating dynamic report content using the Actuate JavaScript API. This chapter describes using Actuate JavaScript API code in a BIRT report. ■ Chapter 3. Working with BIRT Data Analyzer and cross tabs. This chapter describes the BIRT Data Analyzer and the use of cross tabs. ■ Chapter 4. Actuate JavaScript API classes. This chapter lists all of the standard Actuate JavaScript API classes and their methods. ■ Chapter 5. BIRT Data Analyzer API classes. This chapter lists all of the cross tab classes and their methods.
About Using Actuate JavaScript API v vi Using Actuate JavaScript API Chapter
Chapter 1Creating a custom web page using the Actuate JavaScript API
This chapter contains the following topics: ■ About the Actuate JavaScript API ■ Accessing the Actuate JavaScript API ■ Establishing an HTTP session with an Actuate web application ■ About Actuate JavaScript API security integration ■ Viewing reports ■ Navigating repository content using ReportExplorer ■ Using dashboards and gadgets ■ Using and submitting report parameters ■ Retrieving report content as data
Chapter 1, Creating a custom web page using the Actuate JavaScript API 1 About the Actuate JavaScript API The Actuate JavaScript API enables the creation of custom web pages that use Actuate BIRT report elements. The Actuate JavaScript API handles connections, security, and content. The Actuate JavaScript API classes functionally embed BIRT reports or BIRT report elements into web pages, handle scripted events within BIRT reports or BIRT report elements, package report data for use in web applications, and operate the BIRT Viewer and Data Analyzer. To use the Actuate JavaScript API, connect to Actuate Information Console or Deployment Kit for BIRT Reports. The Actuate JavaScript API uses the Prototype JavaScript Framework. The following directory contains the Actuate JavaScript API source files:
Accessing the Actuate JavaScript API To use the Actuate JavaScript API from a web page, add a script tag that loads the Actuate JavaScript API class libraries from an Actuate application. Start with a web page that contains standard HTML elements, as shown in the following code:
2 Using Actuate JavaScript API
Chapter 1, Creating a custom web page using the Actuate JavaScript API 3 Establishing an HTTP session with an Actuate web application The actuate class is the general controller for the HTTP session. Call actuate.initialize( ) to establish a connection to an Actuate application. Load the elements that are selected by actuate.load( ) before accessing reports or applications. Initialization establishes a session with an Actuate service. To initialize the actuate object, call the actuate.initialize( ) initialization function. To use actuate.initialize( ), provide connection parameters as shown in the following code: actuate.initialize("http://localhost:8700/iportal", null, null, null, runReport, null); where ■ http://localhost:8700/iportal is a URL for the Actuate report application service. This URL must correspond to an Actuate Deployment Kit for BIRT Report application or Information Console application. ■ null specifies the default settings for RequestOptions that are provided by the connected Actuate web application. RequestOptions sets custom or additional URL parameters for the request. To use custom or additional URL parameters, construct an actuate.RequestOptions object, assign the specific values to the object, and put the object into the URL parameter. ■ The third and fourth parameters are reserved. Leave these parameters as null. ■ runReport is the callback function called after the initialization finishes. Specify the callback function on the same page as the initialize function. The callback function cannot take a passback variable. ■ null specifies the optional errorCallback parameter. The errorCallback parameter specifies a function to call when an error occurs. The initialization procedure in this section is the first step in using Actuate JavaScript API objects. Nest the initialization code in the second