Creating a Simple Report using BIRT

Exclusive offer: get 50% off this eBook here
Practical Data Analysis and Reporting with BIRT

Practical Data Analysis and Reporting with BIRT — Save 50%

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

$23.99    $12.00
by John Ward | March 2008 | Java Open Source

BIRT, which stands for Business Intelligence and Reporting Tools, is an Eclipse-based open-source reporting system for Java and J2EE-based web applications. Including the word "Tools" in the acronym is appropriate, since BIRT is in fact a collection of development tools and technologies used for developing reports utilizing the BIRT runtime framework component on your application server. BIRT isn't essentially a product, but a series of core technologies on top of which products and solutions are built, similar in fashion to the Eclipse framework.

The BIRT Report Designer, which is the most visible and familiar product built with the BIRT framework, is an Eclipse plug-in that utilizes BIRT technologies to allow users to design reports in the BIRT document format.

In this article by John Ward we will create a simple report by first setting up a simple project.

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.

Practical Data Analysis and Reporting with BIRT Use the open-source Eclipse-based Business Intelligence and Reporting Tools system to design and create reports quickly
Published: February 2008
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

About the Author :


John Ward

John Ward is a consultant for Innovent Solutions, specializing in BIRT and e-commerce search and navigation solutions. Prior to that, John was an Assistant Vice President for Citibank, North America, managing the training MIS group and overseeing development of new technology-based training initiatives. John actively works with and tests BIRT—an open-source reporting platform built on Eclipse—including development work based on BIRT reports and the BIRT APIs.

John also maintains The Digital Voice blog at http://digiassn.blogspot.com

Books From Packt


Alfresco Enterprise Content Management Implementation


Google Web Toolkit GWT Java AJAX Programming


Java EE 5 Development using GlassFish Application Server


Building Websites with Joomla! 1.5 Beta 1


Learning jQuery : Better Interaction Design and Web Development with Simple JavaScript Techniques


PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo!


Building powerful and robust websites with Drupal 6


Professional Plone Development

 

 

 

Your rating: None Average: 3 (2 votes)
birt by
thanks was so usefull your help

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
z
p
S
p
E
K
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software