itchytoes Posted March 22, 2011 Share Posted March 22, 2011 Hi --I'm a long time user of Jasperreports, but this is my first venture into JasperServer.I wish to use a multi-selection list of values for an input control. My values are numbers (e.g. 1, 2,3..)I want the Collection that gets submitted to the report parameters to be a list of numbers, but it seems like they get sent as String values. I am having a postresql issue with comparing a smallint column to these values, and I think it's because they are Strings.How do I specify what the types of the values are that get sent to the parameter collection? Thanks Link to comment Share on other sites More sharing options...
mdahlman Posted March 23, 2011 Share Posted March 23, 2011 You can't.It seems like a bug to me. Maybe it will be considered an enhancement request... but it's not very nice. Please log it in the tracker.I think for a workaround you'll need to have your report treat these as Strings. For example, I had a report with a Text Element of type Integer with this expression to simply display an element from the Collection:$P{parameter1}.toArray()[0]It worked fine in iReport and in JasperReports Server. But it fails after I add an input control. The input control's query returns Integers in theory... but JRS seems to convert them to Strings. I can work around it by explicitly converting the Collection elements to Strings and then to Integers:Integer.valueOf($P{parameter1}.toArray()[0].toString())Ugly, eh? When the report runs in iReport is converts the Integer to a String then does a valueOf call to turn it back into an Integer. When the report runs in JRS it "converts" the String to a String and then valueOf does it's Integer magic. Oh well.Regards,Matt Link to comment Share on other sites More sharing options...
itchytoes Posted March 23, 2011 Author Share Posted March 23, 2011 Hi -- Thanks for the reply. I was able to work around it in my query by doing a cast to a "char" for the column in question,and then the $X{IN,...} works okay. I don't like that solution, so I might just process then List of Strings myself and just turn it into an "in (..)" string for the query. How do I log an issue into the tracker? 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