The following example will show one of two logos, depending on the value of a report parameter. If the value is equal to 0, we will show the Eclipse logo at
If the value is 1, we will show the BIRT Exchange logo:
This image will reside in the Master Page of the report. So lets take a look at how to do this.
- First, create a new report called DynamicImage.rptDesign
Figure 1. Create new Report
- In the new report design, open up the Master Page tab.
- Drag over a grid, and make it 2 column, 1 row.
- In the 1st column, drag over an Image component.
- For the URL, put in “http://www.eclipse.org/eclipse.org-common/themes/Phoenix/images/eclipse_home_header.jpg”. Be sure to keep the quotes. This is more as a place holder than anything else.
Figure 2. Master Page with Image
- Create a new report parameter called imageSelector. It needs to be an Integer type. In the following screen shot, I am using a List Box and a List of Values for this purpose.
Figure 3. Create new Parameter
- Select the Image.
- Open the Script tab in the Report Designer
- Change the Event to onRender.
- Use the following BIRT Script
if (params["imageSelector"] == 0)
- Save and run.
When you set the value to Eclipse, it will show the Eclipse logo. When set to the BIRT Exchange, it will show that logo.
Figure 4. The Final Report