Recent posts

Forums back online

For several days last week, the BIRT forums were not allowing new Threads.  If you tried to post a question to the forums and ran into this problem, try again. 


BIRT Library Inheritance

In object-oriented development, it is understood that the term inheritance applies when one object can extend another allowing for certain generalized properties to be ‘inherited’ by the new object.  For example, if ‘Fruit’ was an object, then ‘Apple’, ‘Banana’, and ‘Orange’ could extend the ‘Fruit’ object inheriting the natural characteristics of all fruit, plus the ability for each new object to add new characteristics. 

BIRT Library Inheritance

I recently discovered that this same concept can be applied to BIRT Libraries.  I may want to have a generalized set of items that I will use on all my reports, but some of these items may need to be customized for each project that uses them.  For example, the company header for all of my reports should use the same logo and font style but each project may get to define the background color of the header.  

For this example, I created one common library using the BIRT Designer.  Within the library, I created a company header in a grid, with a logo and a label.

I can then create my individual project libraries.  After creating the library, open the Library Explorer view.  You should be able to see your common library in this view while your new project library is still opened.  To extend an item from the common library, drag the item from the Library Explorer view to the Report Outline of your project library.  You can now customize that item within the project library.  For my example, I simply changed the background color of the grid to be a different color for each project.

Now I can create a report using an item from my project library.  If something changes in the common library, like a new font style or company logo, that change will be reflected in all the reports that use these libraries.

 


Creating your own BIRT data source

This Friday (April 18th), Pierre Tessier from Actuate, will be giving a live demonstration on developing your own custom data source for your BIRT reports using the Eclipse Open Data Access(ODA).  The example shown creates a custom data source to the eBay Web Services API.  This is a short 30 minute web based session and should also allow for questions at the end.  More info and sign up here.


Using Properties Files to Localize BIRT Reports

I’ve received a few questions asking how to localize BIRT reports.  BIRT reports can be localized so that your users in offices around the world can see a report in their desired language and formating.  BIRT can automatically take care of the number, date, and currency formatting but there are other parts of the report to consider that would normally consist of static text.  These ncluding labels or text elements within a report, table and column headers, chart titles, etc.  For these elements, we need to replace the static text with external text from a properties file.

To get started, I created a couple of .properties file.  You will need one property file for each locale you plan to support.  For our example, I created one called MyResources_us_EN.properties and MyResources_fr.properties.  These are just text files and contain name value pairs like below.

welcome=Hello
goodbye=Later

…and…

welcome=Bonjour
goodbye=Au revoir

Once you have the properties files created, add them to your report project.  You can now select one of the properties files in the Resource File property of the report design (screenshot below).

 Set Resource File

Now that the properties file has been set, you can assign ‘keys’ to various controls within the report.  To add a key to a label, select the label and then Localization on the Property Editor tab.

Assign resource key

Press the […] button and you can pick the key to use from a list

Pick resource key

Perform these same steps for any other labels within the report.  You can use external text within the chart as well, anywhere you see the following icon.

External Text

Pressing this button will invoke a list like below where you can pick the resource key to use.

Select external text

If you need to externalize text that comes from a database, then you will need to use the mapping feature.  For example, if I want to localize the text from a group header and I want to replace the office number (1 through 7) with the words “First Office” for English and “Premier Bureau” for French, then I start by selecting the Office Number data field.  On the Map tab in the Property Editor, press the Add button to create a map rule.

BIRT Create Map Rule

In this example, when the Office Code field equals Office # 1, then replace the text with the value from our properties file that matches ‘1′.  Create a unique mapping for each value you want to externalize.

Once you have created all your mappings and have assigned the keys to each label or chart, then you are ready to test that it all works.  In order for the resource files to get selected correctly at runtime, we have to remove the locale specific information from the name of our resources file.  You do this by selecting the whitespace on the report again, and then on the Resources tab.  Remove ‘_us_EN’ from the name of the resource file so that it now reads ‘MyResources’ without any locale information at the end.

To test for different languages while in the BIRT Designer, select Window | Preferences | Report Design | Preview.  I’ll select French since that was the only other locale that I have a properties file for.

BIRT Preview Language Selection

Now when I run the report, my labels are replaced, the chart title is replaced, and the group header fields have been replaced.

BIRT Report Preview

If you are trying to set the name of the properties file or assign the resource keys with scripting, then you can do something like below in the beforeFactory event:

   var rr = reportContext.getReportRunnable();
   rr.designHandle.setProperty(”includeResource”, “MyResources”);
   rr.getDesignInstance().getLabel(”GoodbyeLabel”).textKey = “goodbye”;

… or in the onPrepare event of a label control, you can use:

   this.textKey = “welcome”;

If you are using the REAPI to set the location of the resource file… or assign keys, then you can use code similar to:

   config.setResourcePath(”C:/work/eclipse/BIRT_221/resources”);

   task.setLocale(ULocale.FRENCH); 

   IReportRunnable design = null;
   ReportDesignHandle dh = null;

   design = engine.openReportDesign(”C:/workspace_221/birt/Localization.rptdesign”);
   dh = (ReportDesignHandle) design.getDesignHandle();
 
   LabelHandle mylabel = (LabelHandle) dh.findElement(”LastLabel”);
   mylabel.setTextKey(”welcome”);

All of these examples above can be downloaded from:

http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=351


EclipseCon Day 3

Day 3 at EclipseCon has come and gone. I spent the morning preparing for my session on deploying BIRT reports and totally missed the keynote from Sam Ramji from Microsoft… but this blogger can catch you up.

The afternoon sessions on BIRT were very well attended and I really liked how these sessions were arranged. There were (5) 10-minute sessions in the same room all related to BIRT so anyone interested in BIRT reporting could just sit in the same room and the speakers rotated through. I spoke about using the BIRT Web Service Data Source and used an Amazon web service for this example. Pierre Tessier from Actuate showed his BIRT/Google Map mashup example which was very slick. Housing data pulled from a database was plotted on a Google map and conditional formatting on the BIRT report colored the flags on the map. John Ward from Innovent showed an example using the BIRT engine with the Google Web Toolkit (GWT). Philippe Coucaud from NXP showed how to integrate the BIRT chart engine into the Eclipse IDE. One of his examples provided real-time charts of the heap space usage from the IDE. The chart updated itself every second or so and was presented in a View within the Eclipse IDE. The final session was given by Santosh Kumar from IBM who showed his prototype BIRT emitter that produces an Open Document Format (ODF) spreadsheet.

BIRT GoogleMap Mashup

The final BIRT session of the day was from IBM and was divided into two parts. The first half of the session was given by Neil Wang and showed the use of the Open Data Access (ODA) extension within BIRT. This allows a developer to extend the list of available data sources for BIRT reports by adding their own custom data source. This example showed an ODA for connecting to an EMF model. The second half of this session was given by Santosh Kumar and showed a BIRT Composite application for Lotus Notes.

At the end of the day, Jason Weathersby showed some of the cool features coming in BIRT 2.3 later this year. There was lots of chart changes and I was really excited about the script debugger.


EclipseCon Day 2

Today was the start of the regular sessions at EclipseCon and the day was kicked off with Dan Lyons, aka Fake Steve Jobs.  Dan is quite entertaining and gave us a bit of insight into how his blog got started and the story behind how he was finally discovered to be the true author of the blog.  Another EclipseCon attendee summed up a few of the humorous bits of the keynote on his blog.

Paul Clenahan from Actuate (and part of the Eclipse BIRT PMC) gave an introductory presentation on the BIRT project and the room was filled to capacity.  There wasn’t even standing room left and some people were turned away at the door.  This talk really needed a larger room.

I also attended the talk by Justin Miranda who is doing some very honorable work with the Partners in Health.  Justin explained the work they are doing on the OpenMRS (open source medical record system) project to provide health care and medication for the poor and the role that BIRT plays in their online solution.

Today was also the opening of the exhibit hall where some of us had way too much fun playing with the BIRT Rocks Equalizer T-shirts.

BIRT Exchange booth at EclipseCon 2008


EclipseCon Day 1

The weather is incredible in Santa Clara. It’s amazing the difference that 10 degrees makes comparing high 50s in Kansas City to the high 60s here in California. Today was tutorial day at EclipseCon and there were lots of 2 hour sessions to choose from. I spent my day in the BIRT sessions and tried to poke my head outside a few times here and there.

I started my morning with John Ward’s “Basic BIRT Report Development” class. This was a great introductory class and it was nice to see so many interested faces in the room and I learned a few things as well. Jason Weathersby and I taught the “Advanced BIRT Report Customization” class which focused on report and chart scripting… and Scott Rosenbaum taught the “Integrating Reporting into your Application” class which was a very deep dive into the BIRT APIs. Since these three 2-hour tutorials were back-to-back in the same room, I somewhat expected the same people to be there all day. I was a little surprised that the room emptied and filled with a new set of people for each class with very little overlap. It makes sense as I think about it now. The “Basic” tutorial was filled with those new to BIRT or just researching BIRT, the “Advanced” class was filled with folks already using BIRT looking to broaden their knowledge, and the “Integration” class was filled with developers integrating BIRT into an application… and these were clearly 3 different sets of people.

EclipseCon 2008 - BIRT Scripting Session

I’m looking forward to tomorrows BIRT talks.


New BIRT Book Available

I saw an announcement for a new BIRT book called “Practical Data Analysis and Reporting with BIRT“. It was written by John Ward who frequently blogs about BIRT on his blog, “The Digital Voice“. I downloaded the eBook version as PDF so I could read it on the plane this weekend to EclipseCon. So far, I’ve only read the introduction, table of contents, and skimmed the rest, but I can see it is written in a tutorial style with lots of screenshots to help along the way. John Graham is also reading this book and has posted a very thorough review of his progress on his blog.

For those of you in the market for books on BIRT, there are also two others available from Amazon at the links below.

BIRT: A Field Guide to Reporting

Integrating and Extending BIRT


Get to know BIRT at EclipseCon 2008

As I mentioned in an earlier blog post, Talking BIRT-y at EclipseCon in March, I will be presenting 2 sessions on BIRT and will now be presenting on deploying BIRT reports with the iServer Express as well.  In addition to my own sessions, there are lots of other EclipseCon sessions related to BIRT.  In fact, there are 13 different sessions.  The complete list of reporting sessions is available here.  There are 3 BIRT tutorials providing 6 hours of solid learning on Monday, 3 long talks on BIRT on Tuesday, and 2 long talks and 5 short talks on BIRT on Wednesday.  These short talks are very interesting.  There are (5) 10-minute sessions in the same room showing example BIRT reports and charts, application built around BIRT, and extensions to BIRT in a very fast-paced environment.

EclipseCon 2008

EclipseCon is less than a week away so there’s still time to register.  Be sure to stop by and see us at the Exhibit hall.


BIRT Exchange Developer Webinars

Starting this Friday, March 7th, we will host short educational webinars approximately every two weeks. The webinars will be developer oriented and are quick 30 minute sessions that focus on a single topic with time for questions at the end.  The first 3 webinars have been scheduled.  The first webinar is an overview of the iServer Express since we just released this server and want to show it off.  The second webinar is an introduction to the BIRT Designer for the new BIRT user, and the third webinar will cover BIRT scripting and events.

Sign up for the webinars here

The webinar schedule for the rest of the year has not been finalized so add your topic ideas as a comment on this post or email me.


Authors
vdodson
vdodson
Virgil Dodson is a Java Reporting Evangelist at Actuate Corporation. Virgil has over 12 years experience as a software developer. For the past 5 years he has helped Java developers get started with Actuate's embedded reporting products. He holds a Bachelor of Science degree in Computer Information Systems from DeVry.
Posts: 25 | Last post: 9 day(s) ago
Authors