Setting up a Simple Project
So now that we are familiar with the different aspects of the BIRT Workspace,
what now? What does it all mean? How does it all work together? And how do we
use it? Well, that is what we are going to explore next as we build a very simple
report. We will describe components more in detail in the next chapter; so for now
just follow along and see how to navigate in the BIRT environment.
The first thing we want to do when setting up our simple report project is to defi ne
what the project is going to be, and what our first simple report will be. Our fi rst
report will be a simple dump of the employees who work for Classic Cars.
So, the firs t 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, as described
earlier. 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. 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.
Now, we have a very simple report project in which to store our BIRT reports that
we will build in the fi rst few chapters of the book.
Creating a Simple Report
Now that we have our first project open, we will look at creating our fi rst 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. 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.
4. Go to the Data Explorer, right-click on Data Sources, and choose
New Data Source.
5. From the New Data Source Dialog box, select Classic Models Inc. Sample
Database and click on the Next button.
6. On the next screen, it will inform you of the driver information. You can
ignore this for now and click Finish.
7. Under the Data Explorer, right-click on Data Sets and choose New Data Set.
8 . 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.
9. On the Query Dialog, enter the following query and click Finish:
select
*
from
CLASSICMODELS.EMPLOYEES
10. On the next screen, just click OK. This screen is used to edit information
about Data Sets, and we will ignore it for now.
11. Now, from the Outline select Data Sets and expand it to show all of the
fi elds. 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.
12. 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. Doubleclick
on this cell and it will become highlighted. We can now edit it. Type in
"Employee ID."
13. Drag and drop the LASTNAME, FIRSTNAME, and JOBTITLE to the detail
cells to the right of the EMPLOYEENUMBER cell.
14. 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.
That's it! We have created our fi rst 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 fi le under the Navigator,
and choosing Report followed by Run.
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.
|