Hi,
I'm trying to create a jasperserver report in uploading a jrxml generated by iReport.
I have to add input control to my report but I don't find the way for defining a default value.
I need it because my ireport report has an image whose path is given by a parameter.
Is it possible ? (i'm using the 3.5 pro version)
Thank you in advance,
Julien
10 Answers:
Hi Julien
You can define the default value for a parameter by inserting a <defaultValueExpression> element withing the <parameter> element in your jrxml file
e.g.
<parameter name="MyDate" class="java.util.Date">
<defaultValueExpression>
new java.util.Date()
</defaultValueExpression>
</parameter>
hope this helps
Angus
Hi,
My "ireport report" got an image. The image path is given by parameter to the report.
This report was launch by a java prog which sent parameters. The parameter for the image was a string and was declared as a string in iReport.
Now I want use this report with jasperServer. The image path could change, so I need to conserve it as a parameter. I can't let the parameter as a string because it seems impossible to define default values to the parameters declared with jasperserver (I don't want my users have to enter a path for the image, I should be transparent for them).
So I tried to define my image as a ressource and use it as a parameter of my report. But I don't know how to make iReport (I modify the report with iReport) recognise it.
I'm not sure I'm clear, let me know if so.
Thanks,
Julien
jsloubet
Wrote:
I'm not sure I'm clear, let me know if so. |
Not very (but maybe it's just me). I still don't understand where the image path comes from, and what you need a parameter for.
You can have default values for input controls, define a default parameter expression in the report (as Angus said).
If you have the image as a JasperServer resource, you should use "repo:" URLs as image source expression. See the sample reports shipped with JS for examples.
Regards,
Lucian
I have a similar issue with image mapping. I am building a reporting service for an internet mapping application. I need to include an image and a thumbnail of the map area and the crosshair based on parameters sent from the map service. I have tried to add an image to the report and then create an expression something like this
I don't understand why the hard coded image expression that looks exactly the same as the parameter will work in ireport, and in the above url, but when passed as a parameter, it give the following error: Errorloadingbytedata:$P!{image_path} . Surely there is a simple answer.
mc53
Wrote:
I don't understand why the hard coded image expression that looks exactly the same as the parameter will work in ireport, and in the above url, but when passed as a parameter, it give the following error: Error loading byte data : $P!{image_path} . Surely there is a simple answer. |
Did you use $P!{image_path} as image expression? If so, change it to $P{image_path}, only queries can do $P!{..}.
HTH,
Lucian
Hi, and thankyou for your fast reply Lucian.
I have tried $P!{..} and still get "com.jaspersoft.jasperserver.api.JSExceptionWrapper: Byte data not found at location : ((java.lang.String)parameter_image_path.getValue())". I have used paths with escaped \\ and without escapes, and they both give the same errror. Leads me to believe that JS is expecting a certain syntax for image paths. I really need to do it this way becase the image is created by a service and then destroyed after use. It is accessible by the report service only by a path whic the service provides to the report.