Image condition is not getting evaluated after publishing the report

Hello,

I created a report that has a some image components that are presented according to an expression that evaluates a field value and prints the corresponding image as follows:

$F{cop_overall_status}== null ? "C:\\imagepath\\stoplightWhite.png" : $F{cop_overall_status}<= 10 ? "C:\\imagepath\\stoplightGreen.png" : $F{cop_overall_status}<= 20 ? "C:\\imagepath\\stoplightYellow.png" :
"C:\\imagepath\\stoplightRed.png"

All the image components are working fine in the studio "preview", but when i export the report to jasperserver some of those images do not get correctly evaluated here is the results from:

Studio preview:

 

Jasperserver report execution:

 

I've tryed to re-create the images but everythime i do this the image i re-created gets fixed but another one gets the same bug, where the expression is not correctly evaluated and displays a white diamond...

 

Thank you! :)

tiago.abreu's picture
Joined: Sep 27 2016 - 9:22am
Last seen: 5 years 5 months ago

3 Answers:

Do you still have the image expressions pointing to drive C and stuff? That's not a good idea especially when you publish on the server. I'd suggest you to publish an image on the server as a separate object and then reference it in the report using the following syntax in the expression: "repo:/path/to/image"

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 2 weeks 2 days ago

Hello! I switched the "C:\\imagepath\\stoplightWhite.png" with the "repo:<path...>" to the jasperserver and it works fine now, but i cant execute the report in the Jasperstudio "preview" option now. It gives the "Byte data not found at: repo:<path...>". How can i configure the studio to get the image from the jasperserver?

 

 

 

 

tiago.abreu's picture
Joined: Sep 27 2016 - 9:22am
Last seen: 5 years 5 months ago

It's an either/or scenario. The way I do it so that I can see image in both server and JSS is that when I add image I select the "Workspace item", pick an image from workspace and work from there. Then when I publish the report the publish option will ask me if I want to publish the images too and I can pick that. These images will be publish as report resources and they will be referenced by the server too.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 2 weeks 2 days ago
Feedback
randomness