Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Image in a table cell
larrjone
I am using BIRT 3.2.21.
I have a Table bound to a data set that has 3 columns. The last column is type String. I want to display an image in the cell depending on the value of the string instead of the string value. Any examples of this?
Find more posts tagged with
Comments
mwilliams
Take a look at this example. You can see the script in the expression builder in the image editor.
larrjone
Thank you! That helped a lot. I am almost there. But now I am getting a FileNotFound error when running the report. I don't think I have my image files in the BIRT resource folder even though I've copied them just about everywhere. Here is the exception from my catalina.out log:
Jun 2, 2011 4:44:27 PM org.eclipse.birt.report.engine.api.impl.Image getImageStream
SEVERE: newcheck_status.png (No such file or directory)
java.io.FileNotFoundException: newcheck_status.png (No such file or directory)
at java.io.FileInputStream.open(Native Method)
I've looked in Windows->Preferences->Report Design->Resource and it's set to my project folder. Where is the default BIRT resource folder?
Thanks again. I really appreciate the help.
mwilliams
From the designer, the default is your workspace. Where are you placing the files?
larrjone
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78012" data-time="1307367511" data-date="06 June 2011 - 06:38 AM"><p>
From the designer, the default is your workspace. Where are you placing the files?<br /></p></blockquote>
<br />
I have it partially working but now I am seeing a difference in PDF vs HTML reports.<br />
The image is being picked up correctly when I hard code the path like this:<br />
if (row["passed"] == "true") {"/var/lib/tomcat6/webapps/mgr/WEB-INF/classes/green.png"} <br />
else {"/var/lib/tomcat6/webapps/mgr/WEB-INF/classes/red.png"}<br />
<br />
This works for all rows in my table when I generate PDF report.<br />
<br />
However, when I generate an HTML report, only the first row has the image correctly and the rest show a red x because the src path is not correct. The generated HTML source looks like this:<br />
<br />
The first one is correct:<br />
<img id="AUTOGENBOOKMARK_15" src="/mgr/mgmt/reports/image/filecb8605cb-1678-49b2-b30d-d3f1d9ccc2e1.png" alt="" style=" width: 0.229in; height: 0.229in;display: block;"></img><br />
<br />
The second thru last row have an invalid path:<br />
<img id="AUTOGENBOOKMARK_16" src="/usr/share/myserver/www/inst/mgr/reports/images/filecb8605cb-1678-49b2-b30d-d3f1d9ccc2e1.png" alt="" style=" width: 0.229in; height: 0.229in;display: block;"></img>
mwilliams
You could set it up both ways and drop the appropriate one when the output is HTML vs PDF.
larrjone
The problem is, for HTML only, the first row displays the image correctly. All other rows have an incorrect path for the image. Looks like a bug in BIRT when generating rows that contain an image referenced as a resource.
mwilliams
The example I gave you doesn't work in HTML? Is the issue when deployed or from the designer or both?
larrjone
I see the problem when it is deployed. I only use the designer to create the rptdesign files.
mwilliams
I deployed it and put the images in the same location as the report design and it works as expected for me.