What is BIRT
BIRT (The Business Intelligence and Reporting Tools) is a project with an open source code, which supports reporting and business intelligence for web applications (especially based on Java and JavaEE).
BIRT is a high-level project of an independent non-profit organization Eclipse Foundation. The project is supported by an active community of users in the BIRT Developer Center and developers on the BIRT Project page.
BIRT is designed to solve a wide range of tasks in terms of report implementation, from simple operational or enterprise reports (generalization of any information about the activity results for a certain period of time), to analytical data processing in real time (data processing technology consisting in preparation summary information based on large data arrays).
The project provides developers with opportunities to create and integrate reports into applications easily. Constructed BIRT reports are stored in XML and have access to a variety of different data sources, including JDO, JFire, POJO, SQL, databases, Web Services and XML.
BIRT main components
There are two main components in BIRT:
- visual report editor in the Eclipse development environment for creating BIRT reports;
- runtime component for generating reports that can be deployed in any Java environment.
BIRT also includes graphing technology that is fully integrated into the report designer and can be used standalone to integrate graphs into the application.
An architecture diagram of these components is shown below:
The BIRT report consists of four main parts: data, data transforms, business logic and presentation.
Databases, web services, Java objects can serve as a data source for reporting. BIRT supports JDBC, XML, Web Services and Flat File, and also supports the code using to obtain any other data sources. Different data sources can be combined using the INNER JOIN and OUTER JOIN operators.
Reports represent data, as following: sorted, filtered and grouped according to the user needs. Of course, some of these operations can be also performed by the database, BIRT allows performing this even with "simple" data sources (for example, flat files or Java objects).
When data is ready, BIRT has a wide range of possibilities for displaying the report to the user: tables, diagrams, text, and many others. One set of data can be displayed in several ways and one report can represent data from several data sets.
Report with results
Report with a diagram
Example of implementing a simple report with BIRT
Let's say there is a database that stores some information about upcoming events. It is represented by three tables:
- The Event table stores information about the name and description of the event, the date and time of the event. Also, in this table there is a field responsible for storing information about the subject of this event and the user who registered the event.
- The Theme table contains some information about subjects, such as ID and title.
- The User table contains information about users (name, surname, login).
In such case, this database looks as follows:
After that, a template for the BIRT report is created. To do this, run BIRT Report Designer, and click File → New → New Report:
Set the name and location of our report, click Next:
Select the report template Blank Report and click Finish:
After that, we can see an empty report document in the workspace:
Next Datasource should be configured. To perform this, click right mouse button on Data Sources and select New Data Source on Data Explorer tab.
The next step is to select the type of our data source. In the shown case, the data is in a MySQL database, so we select the JDBC Data Source, set the name and click Next.
The data for connection to the database are filled in. The driver for the database should be selected in Driver Class field. Because of MySQL the driver com.mysql.jdbc.Driver is selected.
An address of our database in jdbc:mysql://host:port/schema-name format should be entered In the Database URL field, and a username and a password should be entered in the User Name and Password fields, respectively.
Next, SQL query should be generated to get the set of necessary fields. THEME and USER tables are “attached” to the resulting data set by applying JOIN operator.
When Data Set is ready, it can be moved to the working area of the report using Drag&Drop.
After this operation, Data Set Binding dialog can be seen, where a set of fields to be added to the report should be selected. Select all the fields, then click OK.
A table with the selected in the dialog box fields appeared in the report.
Click the View Report button to run the report on the toolbar:
A page with the report should be open in the browser.