Introduction to BIRT (Business Intelligence and Reporting Tools)
BIRT is an Open source data visualization and reporting platform first released in the year 2004. It allows to pull data from a variety of data sources like SQL Databases, Web Services, XML, JDO Datastores, POJOs etc, structure the data, summarize, calculate and visualize the same. These reports or data visualizations can be very easily embedded into web applications or rich client applications, especially those based JAVA/Java EE.
BIRT has 2 main components
1. BIRT report designer & the Design Engine
This comes as a set of plugins for Eclipse or also as a Rich Client Platform. This allows designing reports which are stored as XML files. The Design Engine is the actual core that is used for creating and modifying the reports. It provides the functionality via a Design Engine API. The BIRT report desinger uses this API to auto generate/construct the XML design files.
2. BIRT runtime / Report Engine
This component uses the Report Design File to generate reports by fetching data from the datasources mapped in the report and render the same in various formats like HTML, PDF, CSV, XLS etc. It exposes this functionality via its Report Engine API. Using this API, it can be embedded in any Java application.
Other components are
1. BIRT charting engine
This is used to design, generate charts in the reports. This is used in the design/report engines to provide the data visualization capabilities.
2. BIRT viewer
The Web Viewer can be used to generate and render reports, and also supports more interactive features such as table of contents, exporting report content to several formats, client and server side printing, as well as report pagination. It uses the BIRT runtime for the same.
BIRT Report Design
BIRT design engine constructs XML based report design – a single “.rptdesign” file which contains everything that is required for the report to execute. BIRT is based on a comprehensive report object model (ROM) that describes all aspects of the report. BIRT’s suite of report-specific XML elements and properties is called Report Object Model (ROM).
A BIRT design is structured as hierarchy of report elements. The term element simply means an object that appears as part of the report. The elements may be visual elements like text boxes, tables, lists, charts, cross tabs etc or non-visual elements like datasources, scripts, data sets etc.
Accessing Data in BIRT
In order to access data in BIRT reports, you need to typically work with the below :
1. Data sources– Typical data sources are relational Databases, XML files, POJOs etc. Data source elements hold all the connection details that are required to fetch data from the source. A BIRT report may have more than one Data sources.
2. Data sets – Typical datasets are SQL queries, stored procedures etc., which define what data is to be pulled into the report. A report may have multiple data sets, at least one dataset for every data source or even multiple datasets on a single data source. BIRT also allows us to join 2 datasets to create a “joint dataset”. This can be very useful to join data from disparate data sources or from non-relational data sources like xml files etc.
3. Data cubes – These are specifically introduced to support dynamic crosstabs. It allows you to specify the row fields and hierarchy,the column fields and hierarchy and also the measures to be shown in the body of the crosstab. It does not require the query data to already be in a multi-dimensional structure, the cube transforms the flattened data into hierarchical, analysis ready data.
4. Column bindings – The data from the datasets/data cubes can be displayed/used in various report elements like tables, charts, text boxes by creating “column bindings”. The Column bindings are an intermediate layer between the report elements
and the dataset fields. Typically a “column binding” is an expression which uses the dataset fields to formulate the data to be displayed to the end user in a report element. These are also useful to give descriptive names to the dataset fields, accessing data from functions or user defined calculations, it makes creation/updation of calculated fields quite easy.
Report Structure / Layout
A report document is typically structured as a series of sections like Report Title, multiple Detailed sections which may also contain groups (group headers, footers), summary sections. These sections may contain single or multiple report elements.
BIRT report elements broadly fall in 2 categories:
1. Elements that display/visualize data like Label, Text, Dynamic text, image, chart, crosstab etc
2. Elements that help organize other elements in to the section (Containers) like Grid, Table, Lists etc
A Grid is row/column format container, used to organize static elements like text, pictures into sections, similar to a HTML Table.
A Table on the other hand is used to display dynamic data in row and column format. Table has 3 types of rows, header, footer and detail row. It can be bound to a single dataset only.
A List is used to display dynamic data in any other format than rows and columns. It also contains header, footer and detail areas.
Content Formatting / Styling
BIRT provides a lot of formatting properties on the report elements which follows the CSS specification. The properties on various Elements depend on the type of element / type of data bound to the element as well.
Apart from this option to set formatting on every report element, BIRT also allows us to define Styles and applying the same to multiple elements. Styles may also be imported from CSS files or external CSS files can be linked to the report design.
BIRT also supports Conditional Formatting of the report elements by defining formatting rules.
BIRT has a concept of “Master Pages”. These are used to define the dimensions (page size) and styles like margins, orientation of the report pages. It has header and footer area where you can add report elements that you wish to see in the page header / footer area. You may use multiple master pages in the same report document.
This is just the most typical things, there is a lot more that can be done with BIRT and its highly customizable report elements and functionalities. Hope this gets you started on the journey to using BIRT reporting.
Shraddha Tambe | Helical IT Solutions
1. BIRT – A Field Guide (3rd Edition)
5. BIRT Developer Guide