Report Developer Guide - IBM

Transcription

IBM Tivoli Change and Configuration Management Database 7.1.1IBM Maximo Asset Management 7.1IBM Tivoli Service Request Manager 7.1IBM Tivoli Asset Management for IT 7.1Report Developer Guide

NoteBefore using this information and the product it supports, read the information in “Notices” on page 41.This edition applies to version 7, release 1, modification 1 of IBM Tivoli Change and ConfigurationManagement Database, version 7, release 1, modification 0 of IBM Maximo Asset Managment, IBM ServiceRequest Manager, and IBM Tivoli Asset Managment for IT and to all subsequent releases and modificationsuntil otherwise indicated in new editions. Copyright International Business Machines Corporation 2007, 2008. All rights reserved.US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP ScheduleContract with IBM Corp.

ContentsAbout This Publication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vChapter 1: Loading and Configuring BIRT Report Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Reporting Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Defining BIRT Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installing BIRT Report Engine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installing BIRT Report Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Designer Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Designer Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Designer File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Libraries Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reports Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Scriptlibrary Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Templates Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Tools Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .System Setup for Design-Time Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Prerequisites to Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installing Design Time Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Report Designer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1111222223333444446Chapter 2: Creating a BIRT Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Preparing to Write your First Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Understanding Report Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Creating a Grouped BIRT Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Chapter 3: Advanced BIRT Reporting Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reviewing Database Types, SQL Information, and Update Functionality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .BIRT Data Type Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .SQL Design Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Date Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Testing for Null. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Scalar Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Conditional SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Adding Database Update Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Executing Additional Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Queries in the Fetch Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Queries in the Open Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Linking Result Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Formatting the Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Creating a Hyperlink from One Report to Another . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Registering a Report with Application Toolbar Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Registering a Report for Multiple Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151516161717171818191920202121222224Chapter 4: Setting up Localized Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Localizing Report Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25Enabling Report Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Copyright IBM Corp. 2007, 2008iii

Importing Report Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Localizing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Examples of Report Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26262727Chapter 5: Working with Report Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Report Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Current/Selected/All Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Parameter-Based Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Bound Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Unbound Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Current/Selected/All and Parameter-Based . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Bound and Unbound Parameters in SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Bound Parameters in SQL Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Unbound Parameters in SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Adding Unbound Parameters to Report SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Using Boolean Values as parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292929293030303030303132Chapter 6: Importing and Exporting Design Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Creating the Import File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Importing Design Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Importing Multiple Design Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Exporting Design Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3333343435Appendix A: System Properties File Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Appendix B: Cron Task File Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45ivReport Developer Guide

About This PublicationThis guide describes report set up, creation, and design tasks for the ReportDeveloper. It also describes advanced reporting features.Intended AudienceThis guide is for Report Developers who will be performing the following tasks:TTTTTT Copyright IBM Corp. 2007, 2008creating a BIRT Reportimporting and exporting report design filesloading and configuring BIRT Report Designersetting up localized reportsusing advanced BIRT reporting featuresworking with report parametersv

Intended AudienceviReport Developer Guide

Loading andConfiguring BIRT ReportDesignery1This guide is written for Java programmers with practical knowledge of BIRT(Business Intelligence and Reporting Tools) Report Designer and the Eclipseenvironment. Eclipse is an open source community whose projects are focused onbuilding an open development platform.This chapter contains the following sections:TBIRT Reporting ToolTBIRT Report Designer FilesTBIRT Report Designer Source FilesTBIRT Report Designer File StructureTSystem Setup for Design-Time FilesTBIRT Report Designer ConfigurationBIRT Reporting ToolIBM uses BIRT as its reporting tool. BIRT is an Eclipse-based open sourcereporting system for Web applications.This section defines BIRT Components.Defining BIRT ComponentsIBM Corporation integrates the following BIRT components:TBIRT Report EngineTBIRT Report DesignerBIRT Report EngineThe BIRT Report Engine is an Eclipse-based tool for viewing reports.The BIRT Report Engine produces a report in HTM, CSV, or PDF format so youcan view that report in your browser. Copyright IBM Corp. 2007, 20081

BIRT Report Designer FilesInstalling BIRT Report EngineThe BIRT Report Engine is embedded on your system. When you installed yourapplication software, you also installed the BIRT Report Engine.BIRT Report DesignerUse BIRT Report Designer for report development. The designer uses an Eclipsebased interface and creates reports that integrate into Web applications.Installing BIRT Report DesignerFor information on installing the BIRT Report Designer, access IBMdeveloperWorks.NOTEIf you do not have JDK 1.5 (5.0), you must install it.BIRT Report Designer FilesBIRT Report Design files are xml files, noted by the extension .rptdesign. BIRTReports can contain single or multiple files. The files are categorized as eitherlibrary files or resource files.BIRT library files are also xml files and have the extension .rptlibrary. BIRT libraryfiles contain code that is used multiple times for items such as font type, size, pagenumbers, and time stamp. The individual files can be reused multiple times inBIRT report designs and templates.Resource Files contain items such as images or external files. Resource files can beused by either report design files or library files. Property files are also resourcefiles. Many different report designs use the same property file.The xml of the BIRT Report details which library files and resource files the reportrequires. Without these files, the BIRT report does not execute.BIRT Report Designer Source FilesIBM delivers multiple reports to you so you can analyze specific problems, viewdata in a manner that is not available in a specific application, or print out recordresults for action or record keeping.NOTERefer to the Information Center for a complete list of out-of-the-box reports IBMships to you with this product.In addition, you can customize the reports IBM delivers to you to either add ordelete a field, add your corporate logo, or change the sorting. You can also createyour own customized reports to meet your specific business requirements.Therefore, IBM includes the report design files so you can customize them orreview the content as examples for creating your own reports.2Report Developer Guide

BIRT Report Designer Source FilesBIRT Report Designer File StructureThe BIRT Report Designer file structure contains the following subfolders:TlibrariesreportsT scriptlibraryT templatesT toolsTThe following sections describes these subfolders in detail.Libraries FolderThe libraries folder contains all application properties files. The properties filecontains the report title and label values. This file is required to import a reportand for localization.The libraries folder also contains the following system library braryDo not modify the two system library files in the libraries folder. If you modifythese files, you may corrupt your reports.Reports FolderEach application in your system corresponds to a folder in your reports subfolder.Your license controls which applications you can see.The report design file structure for BIRT contains the following path: Product root \reports\birt\reports\ applicationfolder name Each of the application folders corresponds to an application. The applicationfolder contains report design files. For example, the People folder represents thePeople application. The People folder contains the person details.rptdesign filethat represents the Person Details report.The People folder also contains a report.xml file. This file is common to all reportsin this subfolder. For example, all the reports in the People folder use thereports.xml file, also in the People folder. The exact content of the file varies byapplication.The report.xml file contains information necessary for you to import a report,such as the file name, description, and parameter information.Scriptlibrary FolderThe scriptlibrary folder contains scripting code. The system requires this code foryou to enable IBM reports.Loading and Configuring BIRT Report Designer3

System Setup for Design-Time FilesTemplates FolderThe templates folder contains IBM report templates. These are the only templatesyou should use when you create a new report. For more information ontemplates, see “Understanding Report Templates,” on page 9.Tools FolderThe tools folder contains tools for you to import and export reports from yourclient machine to the system database. For more information on importing andexporting, see Chapter 6.System Setup for Design-Time FilesThis section contains actions you must complete to setup and install Design-Timefiles on your system. After completing this section, you can begin customizing orcreating your reports.Prerequisites to InstallationTo create or customize BIRT reports, you must have both Eclipse and BIRT ReportDesigner downloaded on your client machine. This release uses and supports thefollowing versions:TBIRT Report Designer version 2.1.2.For information on installing the BIRT Report Designer, access IBMdeveloperWorks.TEclipse version 3.2.2If you do not already have Eclipse loaded on your machine, contact yourSystem Administrator for downloading information.Installing Design Time FilesThe following instructions describe how to install Design-Time files.In the file paths below, v20060926-0959 is a version number and may be differentdepending on the your version.1 Locate the compiled classes for report scripting from the Product root location. Product root \reports\birt\scriptlibrary\classes2 Copy the entire \com folder to the following iewer 2.1.2.v200609260959\birt\WEB-INF\classes4Report Developer Guide

System Setup for Design-Time FilesIf necessary, create the \classes folder.3 Copy mxreportdatasources.properties using the same source and destinationfolders from Step 1.4 Edit the file as follows:a Set the URL, driver, username, password, and schemaowner properties,following the sample format provided.b Change # DataSourceName to maximoDataSource.Additional InformationAs the Report Developer, you will need the mxreportdatasources.properties filefor connection information.# DataSourceName . propertyNam

System Setup for Design-Time Files Loading and Configuring BIRT Report Designer 5 If necessary, create the \classes folder. 3 Copy mxreportdatasources.properties using the same source and destination folders from Step 1. 4 Edit the file as follows: a Set the URL, driver, username, password, and sche