Thanks to all who attended today's OpenText Support Community Event: Customer Contributions to Knowledge Program.

A recording of the event and the next steps to start your contributions can be found here:

Customer Contributions to Knowledge Presentation

Let's get started!

BIRT - dynamic change background image based on data set

I'm looking for a way to define the background image base on value of my data set. For instance, if "Country" is USA, then> imgBG1.jpg, and if country is Sweden, then> imgBG2.jpg

The previous post ""How to set a background image on the MasterPage?""
gives the first part of the answer

reportContext.getReportRunnable().getDesignInstance().getMasterPage("MasterPageName").getStyle().backgroundImage = "FileLocation";

Now, in a script of the table that contains my field, how do a evaluate the value of a field? I tried a basic.

if(this.dataSetRow["Country"]=="Sweden") { 
    reportContext.getReportRunnable().getDesignInstance().getMasterPage("Simple MasterPage").getStyle().backgroundImage = "img/imgBG2.jpg"; }

This gives error TypeError: Cannot read property "Country"

I guide I am missing a context.



  • Hi!
    So, maybe two things: 1. I don't believe you need the 'this.' in front of 'dataSetRow["Country"]. And 2. If you're using the value already in the table, shouldn't you be using row["Country"], because that would be specifically evaluating the value of the table field, not the actual value being passed from the data set....

    Hope maybe one of these helps.

    Have a great day!

Sign In or Register to comment.