Hi all,
I have an image field with this expression:
$F{IMAGE} == null ? null : "http://server:port/service?imageuri=" + $F{IMAGE}
I need that if the server does not return a response after 2 seconds, the expression return null.
I search in the forum and google, but I didn't find anything that can help me.
Do you have any ideas? Thanks
3 Answers:
I think the cleanest way to do this would be to write a helper class (in Java) that puts a timer around the URL call and returns null if it takes too long, otherwise returns your image. I'm not sure it's possible directly in the expression editor as it will not evaluate the URL in the image field until the report is filled. Do you know how to create a helper class?
Scriptlets and Helper Classes are very similar in nature. Both are written in Java. Both are referenced directly in your jrxml report in Studio. Scriptlets contain predefined methods that execute at certain times during the report execution/fill process but can also include additional methods that can be referenced at any point in your report (like a helper class) and are attached to individual reports during the report design process. Helper classes are essentially user-built utility methods built in java, compiled to a JAR file and included on the server, making them available to all reports at all the times. This is a high level description.