Tuesday, June 2, 2009

BIRT Report Libraries

What is a report library?

BIRT Report library is a place where you can store report elements such as Datasource information, datasets, parameters and styles and use them across multiple reports. When you change the information in the libraries, the changes are automatically reflected in the reports.

Why Libraries are so useful?

Say for example, you have about 10 reports using information from Tivoli data warehouse and suddenly the database password changes. Without the library, you will need to update the userid/password in the datasources defined in the 10 reports. Instead if you created the datasource at the library and shared it across the 10 reports, then you just need to update the userid/password in the library. Which one do you like?

How can I create and use libraries?

In BIRT, you can create a library using File->New->Library. Creating any report component in library is the same as creating them in a normal report design. To use the library, goto your report design file, goto library explorer and right click the newly created .rptlibrary file and select Use Library. This option will be available only if the library is not already in use (See the picture above).

Now, all the resoures created in the library are available for your report design. Just drag and drop necessary elements from library explorer to your data explorer.

How do I create a same look-and-feel for all my reports?

Create a master page in the library and share it across your reports. Also define styles in the library using your own custom theme and use the theme across your reports. To use the library master page in your reports, go to the XML Source for the report design. Look for the line containing something like the following.

simple-master-page name="Simple MasterPage" id="2"

Assuming your library master page is named GBSMasterPage and your library is named GBS, replace the above line with the following.

simple-master-page name="Simple MasterPage" id="2" extends="GBS.GBSMasterPage"

Now, your report design uses the same look-and-feel defined in the library.

I hope this article gives you enough information to get started on the BIRT report libraries. If you have any questions, please feel free to post your comments.

No comments: