How to use embedded images depending on data values

cheaptrick
edited February 11, 2022 in Analytics #1
Hi,

in my report I have 2 emdedded images (Rot.gif - red button and Gruen.gif - green button).
Depending on data values one of these buttons should be shown.
I found a description how t do it in the folloging thread: "How to use embedded images in a dynamic way?". I tried it but it doesn't work.
Here's the expression I used in BIRT 2.1.2:
if (row["Anzahl"] == 1) {
"images/Rot.gif";
} else {
"images/Gruen.gif";
}

It seems BIRT can't find the images in my report. Has anyone an idea what's wrong?

Regards

Hans

Comments

  • JMaleski
    edited December 31, 1969 #2
    Inside my Images JavaScript onRender method I have something like the following:

    if (row["Anzahl"] == 1) {
    this.file = this.file.replace("Rot", "Gruen");
    }

    This assumes that the default is "Rot" and switches the image to "Gruen" when it finds the value "Anzahl" in the row.