Skip to main content



      Home
Home » Archived » BIRT » image path in computed column
image path in computed column [message #368021] Mon, 27 April 2009 16:13 Go to next message
Eclipse UserFriend
Hi,
I use a dataset computed column to choose a path to an image based on a
score in the row. (think traffic light: high score = green image, low
score = red image). I can use an absolute path in the expression or a full
url eg 'http://myhost/i/red.png'. However, I cannot find an path/url which
works reliably for deployments on different servers. Is there some method
which will allow me to use a relative path in this situation so that I do
not have to replace image paths on a per deployment basis?

Any pointers/help will be much appreciated.

Regards,

Peter
Re: image path in computed column [message #368037 is a reply to message #368021] Tue, 28 April 2009 11:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Peter

You could just put the image in the table in not in the computed column
and use the resource folder. If you have to have it in the computed
column, an expression like this should work:

greenarrow = reportContext.getResource("greenarrowxsmall.png");
importPackage(Packages.java.io);
importPackage(Packages.java.lang);
importPackage(Packages.java.awt);
importPackage(Packages.java.net);
importPackage(Packages.javax.imageio);

image = ImageIO.read(greenarrow);
baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
bytesOut = baos.toByteArray();


This assumes the image is in the resource folder which is set in the
web.xml in the deployed environment and in the preferences within the
designer.

Jason

Peter Courcoux wrote:
> Hi,
> I use a dataset computed column to choose a path to an image based on a
> score in the row. (think traffic light: high score = green image, low
> score = red image). I can use an absolute path in the expression or a
> full url eg 'http://myhost/i/red.png'. However, I cannot find an
> path/url which works reliably for deployments on different servers. Is
> there some method which will allow me to use a relative path in this
> situation so that I do not have to replace image paths on a per
> deployment basis?
>
> Any pointers/help will be much appreciated.
>
> Regards,
>
> Peter
>
Re: image path in computed column [message #368079 is a reply to message #368037] Thu, 30 April 2009 03:38 Go to previous messageGo to next message
Eclipse UserFriend
Many thanks Jason, I will try this out and let you know how it goes.

Regards,

Peter
Re: image path in computed column [message #368085 is a reply to message #368037] Fri, 01 May 2009 03:55 Go to previous message
Eclipse UserFriend
Hi Jason,

The computed column contains the path to an image and is computed based on
row data value and various runtime report parameters, so, cannot be
pre-computed and stored in the table. All I needed to do was replace the
computed string value in the expression eg "src/main/webapp/i/red.png"
with reportContext.getResource("red.png") and move red.png into the
resources folder.

Many thanks.

Peter
Previous Topic:Q: combination charts and tooltips
Next Topic:close connection pool
Goto Forum:
  


Current Time: Tue Jul 08 15:23:35 EDT 2025

Powered by FUDForum. Page generated in 0.06118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top