I am trying to take a database value and append a .png a the end to create the path to an image using iReport.
If it was html the equivalent would be
<img src ="http://someurl.com/${databasevalue}.png"/>
I am using iReport 3.1.2
Thanks in advance.
4 Answers:
It seems like the solution is to use the imageExpression tag.
<image hyperlinkType="None">
<reportElement x="370" y="2" width="42" height="17"/>
<imageExpression class="java.lang.String"><![CDATA["http://www.translatorscafe.com/cafe/images/flags/US.gif"]]></imageExpres...
</image>
But I am having trouble adjusting it so that it changes per row.
So far I tried...
<image hyperlinkType="None">
<reportElement x="370" y="2" width="42" height="17"/>
<imageExpression class="java.lang.String"><![CDATA["http://www.translatorscafe.com/cafe/images/flags/"$F{Country_ISO3166}".gif"]]></imageExpression>
</image>
But there appears to be an error with the expression. Any help would be appreciated.
I got it working, just needed to you the "+". Like so...
"http://www.translatorscafe.com/cafe/images/flags/"+ $F{Country_ISO3166} +".gif"
What I posted earlier is just the expression I used in iReport. The actual XML is the following.
<image onErrorType="Blank" hyperlinkType="None">
<imageExpression class="java.lang.String">
<![CDATA["http://www.translatorscafe.com/cafe/images/flags/"+$F{Country_ISO3166} +".gif"]]>
</imageExpression>
</image>