Tutorial Part One

Smarten up your data with Eclipse BIRT

From March's JAX Magazine, former Eclipse BIRT evangelist Jason Weathersby guides us through some of the major features within the business intelligence reporting toolkit

Eclipse’s Business Intelligence and Reporting Tools (BIRT) is an open source project based on the Eclipse IDE and is used to build and deploy reports in a Java/J2EE environment. As of this writing, the current version is BIRT 4.2 - the ninth major release - and the BIRT project continues to be very popular with more than twelve million downloads. BIRT contains many features and supports both OSGi and POJO runtimes, allowing developers to integrate with many types of applications.

This article series will serve as an introduction to the BIRT project, with a focus on the BIRT designer, highlighting some of the major features used to build and customize reports and libraries. General details about the BIRT pipeline, event handling and expressions will also be explained. Deployment in general will not be discussed in this article, but information about the AJAX based Web Viewer, the Report Engine API, and the BIRT tag libraries can be found on the Eclipse website. Figure 1 shows just a few of the things you can do in Eclipse BIRT.

Figure 1: BIRT Collage


Most IT software as well as many other applications focus on processes to collect, analyze and present data. The field of Business Intelligence (BI) is the use of this data by IT professionals and business analysts to improve business decision-making. 

In the past, BI data was typically presented in the form of page-based printed reports. Even today, many reporting systems still use this metaphor at the core of their architecture which, let’s face it, does not match well with the web-focused interactive experience we use to make decisions today. In fact this page-centric view limits the ability of a designer from easily integrating such systems into Rich Client Platforms (RCP) and often leads to reports being custom built from scratch.

BIRT was created from the ground up to address the need for a reporting system with the web interface central to its architectural design, built with RCP technology in mind and  based on the industry-leading open source Eclipse platform. As you'll see, BIRT's modern design, along with the highly interactive and extensible BIRT Designer, allows the implementation of highly visual and dynamic rich client applications.

Before discussing the BIRT Report Designer, an overview of the BIRT Pipeline, event handling and the BIRT Expression Builder is in order. These three areas affect virtually every aspect of the BIRT design experience.


BIRT Report designs are XML documents that are created in the report design tool. These designs can either be created from a report template or started from scratch with a blank design.

Templates are often used to set up header and footers and offer a starting point for common report types. Reports can optionally reference report libraries, which are XML documents that contain portions of a report. For example, if your company header is published to a report library, this header can then be used in all of your reports – and if the header is changed at a later date, the reports that reference this library will automatically show the changes the next time the report is executed. Most BIRT report items can be placed in a library by simply right clicking on an existing report item in the design tool and choosing the export to library function. Libraries can also be constructed from scratch, in a similar fashion to building a report design.

Figure 2: BIRT Pipeline

The BIRT engine processes the report in two phases called generation and presentation, as shown in Figure 2, and these two phases can be executed in one or two separate processes. The example BIRT Java Web app (WebViewer) and the Report Engine API allow both possibilities. In the WebViewer, this feature is controlled using a servlet mapping. If you are using the Report Engine API, different method calls are available to determine how the report is executed.

During the generation phase, parameters are processed, data sources retrieve data for the report and all report items are prepared and created. Pagination is also handled in this phase. At the end of the generation phase, depending on how the report is being executed, an optional report document is created.  The report document is only created when generation and presentation are executed in two different processes, and its file has the extension .rptdocument. The optional rptdocument file is used to support Table of Contents operations and paginated HTML. As an additional benefit, the report document offers the ability to run the report once and render it many times at a later date and possibly on another machine, without having to access the data sources again. 

The presentation phase then renders to the requested output. Currently BIRT supports HTML, paginated HTML, PDF, DOC, XLS, PPT, ODS, ODT, OPD, and PostScript. 

The BIRT engine is encapsulated in the BIRT report designer, the example WebViewer, and within the Report Engine runtime. This allows a developer to simply deploy the WebViewer to a Java Web app container to run and render the reports, or an Eclipse developer to use the report engine in plug-in format within an OSGi based application (RCP application), or as a set of libraries that can be added to any Java based application (Servlet, Command Line). 

Event Handling

During the processing of a report, BIRT provides event hooks that can be used to alter how the report is generated. For example, the developer may want to use different stylesheets that depend on the date, or hide/unhide specific tables and charts based on predefined external conditions or input parameters. These event hooks can be implemented in Java or JavaScript. Within the report designer, these hooks are exposed with a JavaScript editor and a dropdown list of all event hooks a particular report item supports. BIRT uses the Mozilla Rhino engine for all JavaScript processing.

Figure 3: Event Handlers

In Figure 3, a data set event handler is shown for the beforeOpen event. This handler modifies the SQL query executed. Most report items support events for preparing, creating and rendering a specific report item. In addition, certain report items expose more events.  For example, Charts exposes over thirty events that can be used to customize almost all aspects of a chart.

These events are executed server-side during the creation and rendering of a report. BIRT can also make use of client-side script, which will be discussed in Part Two of this article next month. To implement an event handler in Java, see the BIRT website.

Author Bio: Jason Weathersby was previously the BIRT Evangelist at Actuate Corporation and a member of the Eclipse Business Intelligence and Reporting Tools (BIRT) Project Management Committee (PMC). He is now the Technical Evangelist at Technical Evangelist at Mozilla Corporation

This article first appeared in JAX Magazine:Reality Check in March. To read that and other issues, click here. Stay tuned for Part Two later in the week.

Image courtesy of peretzp

Jason Weathersby
Jason Weathersby

What do you think?

JAX Magazine - 2014 - 06 Exclucively for iPad users JAX Magazine on Android


Latest opinions