Deployment of Reports with BIRT

0
152
4 min read

Everything in this article uses utilities from the BIRT Runtime installation package, available from the BIRT homepage at http://www.eclipse.org/birt.

BIRT Viewer

The BIRT Viewer is a J2EE application that is designed to demonstrate how to implement the Report Engine API to execute reports in an online web application. For most basic uses—such as for small to medium size Intranet applications—this is an appropriate approach. The point to keep in mind about the BIRT Web Viewer is that it is an example application. It can be used as a baseline for more sophisticated web applications that will implement the BIRT Report Engine API.

Installation of the BIRT Viewer is documented at a number of places. The Eclipse BIRT website has some great tutorials at:

http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php

http://wiki.eclipse.org/BIRT/FAQ/Deployment

This is also documented on my website in a series of articles introducing people to BIRT:

http://digiassn.blogspot.com/2005/10/birt-report-server-pt-2.html

I won’t go into the details about installing Apache Tomcat as this is covered in depth in other locations, but I will cover how to install the Viewer in a Tomcat environment. For the most part these instructions can be used in other J2EE containers, such as WebSphere. In some cases a WAR package is used instead. I prefer Tomcat because it is a widely used open-source J2EE environment.

Under the BIRT Runtime package is a folder containing an example Web Viewer application. The Web Viewer is a useful application as you require basic report viewing capabilities, such as parameter passing, pagination, and export capabilities to formats such as Word, Excel, RTF, and CSV.

Deployment of Reports with BIRT

For this example, I have Apache Tomcat 5.5 installed into a folder at C:apache-tomcat-5.5.25. To install the Web Viewer, I simply need to copy the WebViewerExample folder from the BIRT Runtime to the web application folder at C:apache-tomcat-5.5.25webapps.

Deployment of Reports with BIRT

Accessing the BIRT Web Viewer is as simple as calling the WebViewerExample Context.

Deployment of Reports with BIRT

When copying the WebViewerExample folder, you can rename this folder to anything you want. Obviously WebViewerExample is not a good name for an online web application. So in the following screenshot, I renamed the WebViewerExample folder to birtViewer, and am accessing the BIRT Web Viewer test report.

Deployment of Reports with BIRT

Installing Reports into the Web Viewer

Once the BIRT Viewer is set up, Deploying reports is as simple as copying the report design files, Libraries, or report documents into the application’s Context, and calling it with the appropriate URL parameters.

For example, we will install the reports from the Classic Cars – With Library folder into the BIRT Web Viewer at birtViewer. In order for these reports to work, all dependent Libraries need to be installed with the reports. In the case of the example application, we currently have the report folder set to the Root of the web application folder.

Deployment of Reports with BIRT

Accessing Reports in the Web Viewer

Accessing reports is as simple as passing the correct parameters to the Web Viewer. In the BIRT Web Viewer, there are seven servlets that you can call to run reports, which are as follows:

  • frameset
  • run
  • preview
  • download
  • parameter
  • document
  • output

Out of these, you will only need frameset and run as the other servlets are for Engine-related purposes, such as the preview for the Eclipse designer, the parameter Dialog, and the download of report documents.

Out of the these two servlets, frameset is the one that is typically used for user interaction with reports, as it provides the pagination options, parameter Dialogs, table of contents viewing, and export and print Dialogs. The run servlet only provides report output.

Deployment of Reports with BIRT

There are a few URL parameters for the BIRT Web Viewer, such as:

  • __format : which is the output format, either HTML or PDF.
  • __isnull: which sets a Report Parameter to null, parameter name as a value.
  • __locale: which is the reports locale.
  • __report: which is the report design file to run.
  • __document: which is the report document file to open.

Any remaining URL parameter will be treated as a Report Parameter. In the following image, I am running the Employee_Sales_Percentage.rptdesign file with the startDate and endDate parameters set.

Deployment of Reports with BIRT

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here