Creating a Simple Report using BIRT

Use the open-source Eclipse-based Business Intelligence and Reporting Tools system to design and create reports quickly

Setting up a Simple Project

The first thing we want to do when setting up our simple report project is to define what the project is going to be, and what our first simple report will be. Our first report will be a simple dump of the employees who work for Classic Cars.

So, the first thing we need to do is set up a project. To do this, we will use the Navigator. Make sure you have the BIRT report perspective open. Use the following steps to create our project:

  1. Open up the Navigator by single-clicking on the Navigator tab.
  2. Right-click anywhere in the white-space in the Navigator.
  3. Select New from the menu, and under New select Project.
  4. From the Dialog screen, select Business Intelligence and Reporting Tools from the list of folders; expand that view, and select Report Project. Then click on the Next button.
  5. Creating a Simple Report using BIRT
  6. For the Project name, enter Class_Cars_BIRT_Reports. You can either leave the Use Default Location checkbox checked, or uncheck it and enter a location on your local drive to store this report project.
Creating a Simple Report using BIRT

Now, we have a very simple report project in which to store our BIRT reports starting with the first that we are about to create.

Creating a Simple Report

Now that we have our first project open, we will look at creating our first report. As mentioned earlier, we will create a basic listing report that will display all the information in the employees table. In order to do this, we will use the following steps:

  1. Right-click on the Class_Cars_BIRT_Reports project under the Navigator, and choose New and Report.
  2. Make sure the Class_Cars_BIRT_Reports project is highlighted in the new report Dialog, and enter in the name as EmployeeList.rptdesign. I chose this name as it is somewhat descriptive of the purpose of the report, which is to display a list of employees. As a rule of thumb, always try to name your reports after the expected output, such as QuarterlyEarningReport.rptdesign, weeklyPayStub.rptdesign, or accountsPayable.rptdesign.
  3. Creating a Simple Report using BIRT
  4. On the next screen is a list of different report templates that we can use. We will select  Simple Listing and then click on the Finish button.
  5. Go to the Data Explorer, right-click on Data Sources, and choose New Data Source.
  6. From the New Data Source Dialog box, select Classic Models Inc. Sample Database and click on the Next button.
  7. Creating a Simple Report using BIRT
  8. On the next screen, it will inform you of the driver information. You can ignore this for now and click Finish.
  9. Under the Data Explorer, right-click on Data Sets and choose New Data Set.
  10. On the next screen, enter the Data Set Name as dsetEmployees, and make sure that our created Data Source is selected in the list of Data sources. You can click Next when this is finished.
Creating a Simple Report using BIRT
  1. On the Query Dialog, enter the following query and click Finish:
  2. Creating a Simple Report using BIRT
  3. On the next screen, just click OK. This screen is used to edit information about Data Sets, and we will ignore it for now.
  4. Creating a Simple Report using BIRT
  5. Now, from the Outline select Data Sets and expand it to show all of the fields. Drag the EMPLOYEENUMBER element over to the Report Designer, and drop it on the cell with the label of Detail Row. This will be the second row and the first column.
  6. Creating a Simple Report using BIRT
  7. You will notice that when you do this, the header row also gets an element placed in it called EMPLOYEENUMBER. This is the Header label. Double- click on this cell and it will become highlighted. We can now edit it. Type in "Employee ID".
  8. Drag and drop the LASTNAME, FIRSTNAME, and JOBTITLE to the detail cells to the right of the EMPLOYEENUMBER cell.
  9. Creating a Simple Report using BIRT
  10. Now, we want to put the header row in bold. Under the Outline, select the Row element located under Body/Table/Header. This will change the Property Editor. Click on Font, and then click on the Bold button.
Creating a Simple Report using BIRT

That's it! We have created our first basic report. To see what this report looks like, under the Report Designer pane, click on the Preview tab. This will allow you to get a good idea of what this report will look like. Alternatively you can actually Run the report and get an idea what this report will look like in the BIRT Report Viewer application, by going up to File/View Report/View Report in Web Viewer. This option is also available by right-click on the report design file under the Navigator, and choosing Report followed by Run.

Creating a Simple Report using BIRT

Although it may be a simple report, this exercise demonstrated how a report developer can get through the BIRT environment, and how the different elements of the BIRT perspective work together.

Summary

For a very simple report design, we utilized all of the major areas of the BIRT perspective. We used the Navigator to create a new report project and a new report design, the Data explorer to create out data connection and Data Set, dragged elements from the Outline to the Report Designer to get the data elements into the right place, and used the Property Editor and Outline cooperatively to bold the text in the table header.

Books to Consider

comments powered by Disqus