Thursday, February 07, 2008

Rewind Your Report Development

I apologize for not blogging here more frequently. Life has gotten busy again. The good news is I have been working on a great BIRT project and learned all kinds of new tips and tricks. Things like dynamically inserting columns into reports, advanced library management, and building an automated report testing framework. Fun stuff, which I hope to to blog about as I find some time.

Today, I just want to give a quick tip. This is one of those things that I have been doing for a long time, but may not be well known. One of the developers that I was working with hadn't ever heard of it, so I thought I would share.

Do you ever wonder why your report suddenly is not working the way it used to? If you are familiar with Eclipse's Local History, you know that in Java you have the ability to see prior revisions of your report development. This handy utility lets you compare the current file with any of the saved revisions from your local system.

The same feature applies to BIRT report designs. If you go to the XML Source tab of your report you will see the underlying XML. Right click anywhere and select compare with
Local History.

























A view shows up with all of the save dates for that file. Select one, by double clicking and a compare editor show up. The current version is on the left, past version on the right.

There are icons for going to the next difference, and icons for synchronizing the two versions. I'm not going to go through all of them, they are fairly straight forward.

One side note, you will find that BIRT tends to save a lot. Every time you run your report at the least. If you are worried about the space required for this you can change the amount of revision history you store using Window => Preferences => General => Local History.

have fun.

Monday, February 04, 2008

BIRT and ILOG JRules

Daniel Selman posted a very interesting Blog on using BIRT Scripted Data Sources with JRules. It is available here: Advanced Rule Studio Reporting using BIRT. In this example, Daniel walks through building a scripted data source that accesses the Rule Studio POJO model to populate a BIRT data set. His example is very informative and should help anyone accessing a POJO as a BIRT data source.

Thursday, January 31, 2008

BIRT Reportlets

BIRT process reports by reading the xml design file (.rptdesign) and optionally producing a binary file called a report document (.rptdocument) and finally renders to one of the supported output formats. One nice aspect of using the report document is that a report can be generated and rendered multiple times at a later date or on a different machine. Running a report this way also allows the user of the engine to optionally render portions of the report document. When using the example web viewer application that comes with BIRT this can be achieved by using the _pagerange and _page URL parameters. For example, if the report document contains a 500 page report you can specify __pagerange=1,5-10 to render only those pages using the /preview servlet mapping.

http://localhost:8080/2.2.1.1/preview?__pagerange=1,5-10&__document=c:/test/myreport.rptdocument&__format=html

or

http://localhost:8080/2.2.1.1/preview?__pagerange=1,5-10&__report=myreport.rptdesign&__document=c:/test/myreport.rptdocument&__format=html&__overwrite=false

Note that if you are using the /frameset servlet mapping with HTML output that this will have no effect. In this particular case you can specify a __page URL parameter and the entire report will be rendered and the specific page will be loaded. The __pagerange parameter will be used with the /frameset mapping, if you select another output such as PDF.

BIRT also supports using bookmarks to locate and render content. Most BIRT report elements support a bookmark expression. The expression can be a simple tag such as “mytable”; or can be complex and based on data retrieved from data sources. The bookmark expression can be set using the BIRT properties view. To render a specific bookmark use the __bookmark URL parameter. When used with the /frameset servlet mapping the viewer will render the entire report and load the page containing the bookmark. When using the bookmark parameter with the /preview mapping the entire report will be rendered and the browser will be scrolled to the proper location. The bookmark parameter can also be used in conjunction with the __isreportlet URL parameter to only render the specific bookmark. When used with /preview mapping only the bookmark will be rendered no matter what output format is rendered. The isreportlet parameter will have no effect if, using the /frameset mapping and rendering to HTML. Rendering to other formats such as PDF will cause the engine to only render the specific bookmark though. As an example assume you have a three page report, where a chart exist on each page. The bookmark expressions for the charts are as follows:

“Chart1”;
“Chart2”;
“Chart3”;

Using the following URL will render only the second chart.
http://localhost:8080/2.2.1.1/preview?__bookmark=chart2&__report=mycharts.rptdesign&__document=c:/test/mycharts.rptdocument&__format=html&__isreportlet=true

Using the following URL will render all three charts and the viewer will load page 2.
http://localhost:8080/2.2.1.1/frameset?__bookmark=chart2&__report=mycharts.rptdesign&__document=c:/test/mycharts.rptdocument&__format=html&__isreportlet=true

If you are using the Report Engine API, these results can be achieved using methods of the RenderTask.

IRenderTask task = engine.createRenderTask(myreportdocument);

task.setPageRange("1-3");
or
task.setPageNumber(3);
or
task.setReportlet("chart3");

Wednesday, November 28, 2007

BIRT Survey

From time to time the BIRT team conducts surveys in order to obtain feedback from the community regarding Eclipse BIRT. The BIRT team is now running a survey that is designed to understand areas of the product that need improving from the point of usability. If you would like to share your opinions on the usability of BIRT , please take ten minutes to fill out this survey. The link to the survey is here.

Thursday, November 08, 2007

Example Repository

I have set up a Subversion version control repository with a number of BIRT examples at:

http://longlake.minnovent.com/repos/birt_example

You can use the Subclipse plug-in to get anonymous read access to the repository.

Some interesting examples:

birt_api_example Contains Design and Runtime examples for building and running BIRT reports
birt_runtime_lib Holds all of the libraries and plug-ins required by the API example

callstack_designer
callstack_runtime Simple ODA example with extensive logging

google_designer
google_runtime ODA example that attaches to Google Spread-Sheets

Monday, October 15, 2007

2.2.1 Memory Woes

Show of hands, how many of you have upgraded to version 2.2.1 of BIRT? Okay, now how many of you have had memory issues? Based on my experience and the messages on the newsgroup, it seems like almost everyone that has moved to 2.2.1 through installation of the new All-In-One build is having this problem. Fortunately, there is an easy fix. The problem is related to a change in the Eclipse.ini file. This is a bug on the entire platform and affects all of the Eclipse products, not just BIRT. To fix open the Eclipse.ini file in your ECLIPSE_HOME directory. Find the line with

-launcher.XXMaxPermSize=256m

Replace that line with
-XX:MaxPermSize=256m

That should solve the problem. The platform team is tracking this bug here. They are trying to make a decision
to release a new version of the platform or not. The BIRT team is also tracking the issue here.

Depending on what the platform team does with a new release, we may create a new 2.2.1a build of BIRT so that
this problem does not continue to exist.

Updated: It has come to my attention that there could be a couple of issues.
First) -XX:MaxPermSize=256m has to be the last line in the eclipse.ini
Second) There is only a single dash before the XX:MaxPermSize

Here is the complete eclipse.ini that I am using on my system. I have bumped the memory numbers a bit since I have plenty of RAM on my system.


-showsplash org.eclipse.platform
-vmargs
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m

SR



Monday, October 08, 2007

Introducing BIRT Exchange

I referenced www.birt-exchange.com in an earlier post, but I thought I'd take the opportunity to formally introduce it.

It's a new site, sponsored by Actuate, that provides a variety of content on Eclipse BIRT and the related products and services Actuate has built on top of the open source project.

I particularly like two features of the site. The first is the DevX area, which is a repository of content about BIRT, including sample reports, code, tips and tricks and links to articles and blogs, both on the site and elsewhere. Anyone can access content or add to the repository. Think of it as a sort of del.icio.us just for BIRT.

The second is the Eclipse BIRT newsgroup mirror, which includes all the posts from the Eclipse.org site, but enables you to read and search them using a web-based forum package. I find it a lot easier to locate answers to questions that may have already been addressed using the forum interface.

Next time you're searching for information on a particular BIRT issue or question, keep in mind BIRT Exchange as another good resource.