macaxrc Posted March 24, 2015 Share Posted March 24, 2015 Hi everybody,I use iReport a JasepserServer 5.5aI need help to load images depending of the query value.I'm new in jasper and I don't find any example.I have this query:select a,b,cfrom tableWhen value of field a is 1 I need to load image 1, when values is 2 load image 2.Anyone have any examples of how to do? I need the same but in a legend, but this don't depending with the query value, I like to change the legend type to an image.Thanks and sorry for my English Link to comment Share on other sites More sharing options...
mlopez_1 Posted March 24, 2015 Share Posted March 24, 2015 Store images in a binary field table and insert image object with Expression value = ${FIELD_NAME}.You can customize your query as you like.This how I retrieve images for the head in Reports. Mariano Link to comment Share on other sites More sharing options...
mlopez_1 Posted March 24, 2015 Share Posted March 24, 2015 Sorry, forgot to say that Class type of filed must by java.io.InputStream Link to comment Share on other sites More sharing options...
ernestoo Posted March 24, 2015 Share Posted March 24, 2015 My suggestion is to try to use Jaspersoft Studio instead of iReport, Studio has a built in "IF" function that would be helpful for you. I have an example here:IF($F{product_family} == "Food","http://images.clipartpanda.com/food-clip-art-Burger1_Food_Clipart.png","http://images.clipartpanda.com/drink-clipart-drink_06.gif")Otherwise youll have to use a teryary statement as explained in this post: https://raymondhlee.wordpress.com/2012/10/06/if-else-in-jasper-reports-expressions/Regarding the image in legend: you probably need to ask in a different question and be specific about which charting library you are using! Probably easier to make the legend manually outside of the chart element Link to comment Share on other sites More sharing options...
macaxrc Posted March 24, 2015 Author Share Posted March 24, 2015 Thanks everybody, but my images are in a resource folder in jasper server. I need load or call one image or other depending of the value. Other way to do that?Thanks for the interest Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now