Tuesday, October 2, 2007

BIRT Example of Reusable Reporting Concepts

Here is a BIRT example showing the reusable reporting concepts in action. This example uses our generic schema in the data layer, presentation layer and internationalized locale property files. It can be downloaded here. This example uses BIRT's Classic Models database for the data source. It has two data sets that conform to our generic schema: Countries Data Set and ProductLines Data Set. The report only uses one at a time. The report also uses four internationalized properties files: Countries_en_US.properties, Countries_fr.properties, ProductLines_en_US.properties and ProductLines_fr.properties. They will be used in conjunction with the appropriate data set and locale setting with the BIRT Designer.

First, make sure your BIRT Designer locale setting is set to English (United States) in Window | Preferences | Report Design | Preview.


Run this report as is to see our report against the Countries Data Set with the column headers displayed in English from our Countries_en_US.properties file.

Change the locale setting to French and rerun the report. The column headers will be displayed from the values in the Countries_fr.properties file.

Now, let's take a look at swapping out the data set without having to change the presentation layer. We can do this inside the BIRT Designer by right-clicking on the Table tab in the report design layout and choosing Edit Data Binding. Choose ProductLines Data Set in the Data Set drop down. Answer "No" to the question about wanting to clear all existing data field information. We answer "No" here to keep all our field names that are set to our generic schema, thus not having to make any changes to the presentation layer. Click "OK" to save settings.

Next, let's set the associated locale properties files. Since we swapped in the ProductLines Data Set for our underlying data, we now need to have the associated column headers display on this report. Click on any part of the report design other than the table to choose the report. Look in the Property Editor under Properties and select Resources. Change the Resource File to ProductLines.
Enlarge

Run this report to see the product line data with appropriate column headers. Change the locale setting to back to English and rerun.

You can now see the powerful capabilities of using our generic schema and internationalization. This two column summary report design can be reused easily by swapping in different data sets and locale property files. Later on, I'll discuss how putting components of the report design in a library will further extend the power of these reusable reporting concepts.

1 comment:

Pranav Aggarwal said...

Hi,

Its nice to meet a BIRT enthusiast. Well i am trying to be one. I am actually working with BIRT and kinda just starter.

I am able to make BIRT reports through Eclipse IDE, but when I need to deploy the reports I am stuck up. I don't know where BIRT reports will fetch the Database connection string and database related information. I am looking to generalize that Database connection issue, rather hard code any where in report. !!!

Secondly, I need to understand how to deploy them into the web application. Will it be wise to just give a link for the BIRT reports in .jsp pages?

I would appreciate if you could tell me how that could be possible.

Thanks,
Pranav