jsloubet Posted May 29, 2009 Share Posted May 29, 2009 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 Link to comment Share on other sites More sharing options...
natalya Posted May 29, 2009 Share Posted May 29, 2009 I define a default value in iReport when I create Parameters for example: Parameter DATE_END : DataType - Date Default Value Expression - new Date() Link to comment Share on other sites More sharing options...
angus Posted May 29, 2009 Share Posted May 29, 2009 Hi JulienYou 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 helpsAngus Link to comment Share on other sites More sharing options...
jsloubet Posted June 2, 2009 Author Share Posted June 2, 2009 Hi, Thanks for your response.Is it not possible to linked the image to the report if this image is defined as a jasperserver ressource ?If not, indeed, I will indeed edit the jrxml to put the image path, hard coded. Julien Link to comment Share on other sites More sharing options...
lucianc Posted June 3, 2009 Share Posted June 3, 2009 jsloubetWrote: Is it not possible to linked the image to the report if this image is defined as a jasperserver ressource ? I don't understand what you are trying to do. Could you ellaborate?Regards,Lucian Link to comment Share on other sites More sharing options...
jsloubet Posted June 5, 2009 Author Share Posted June 5, 2009 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 Link to comment Share on other sites More sharing options...
lucianc Posted June 5, 2009 Share Posted June 5, 2009 jsloubetWrote: 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 Link to comment Share on other sites More sharing options...
mc53 Posted September 10, 2009 Share Posted September 10, 2009 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 . The paramter will be input as a url parameter like this http://155.187.1.78:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/samples/ert&standAlone=true&j_username=jasperadmin&j_password=jasperadmin&ParentFolderUri=/reports/samples&output=html&image_path=C:\WINDOWS\Web\tips.gif. 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. Link to comment Share on other sites More sharing options...
lucianc Posted September 10, 2009 Share Posted September 10, 2009 mc53Wrote: 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 Link to comment Share on other sites More sharing options...
mc53 Posted September 10, 2009 Share Posted September 10, 2009 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. Link to comment Share on other sites More sharing options...
mc53 Posted September 11, 2009 Share Posted September 11, 2009 I have found that the $P{} in the expression must not have quotes around it. That is why the literal parameter_image_path.getValue() is returned instead of the actual value. Thankyou Margot 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