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?"" https://communities.opentext.com/forums/discussion/44730/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.

Thx

Comments

  • 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!
    Scott

    Scott Stanley

    Business Analyst

    North Star BlueScope Steel, LLC

     

Sign In or Register to comment.