Passing the values of multi-select query input control in jasperserver


I have a problem with passing values from a input control to an other. In particolar the first input control PARAM1 is a multi-select query (type: java.util.Collection) and it returns the following value: [11,22,33]. The values are integer ! Now, this values enter in the query in the second input control like this $X{IN,cast(attribute(integer) as varchar(255)),PARAM1}. This expression work in the query report, but don't in the query of the input control? Why? Is there the possibility to transform the PARAM1 type from java.util.Collection to java.util.String? This could solve the problem. There is someone who can help me?  Thank you very much.

giuliana.damiani's picture
Joined: Oct 11 2013 - 1:41am
Last seen: 7 years 3 weeks ago

3 Answers:

java.lang.Integer should work for multi select parameter.

I have tested. by inputting integer values to select mutlple. ( Where we generally assume mutli select should take collection but with integer values we have to take java.lang.Integer for parameter instead java.util.Colleciton).

from 4.7 and greter versions this supports. . We need not to cast in WHERE clause syntax of multi select.


Thank you.


sadakar's picture
Joined: Aug 14 2012 - 3:57am
Last seen: 7 months 3 weeks ago
Thank you so much Sadakar for your help! I set the parameter type to integer and it works,but if I want to pass it to a subreport or to a dataset it doesn't work. Now with Jasperstudio 5.6.2 I solve this issue: you can specify the type of collection.In my case the type is integer and it Works perfectly with the subreport and dataset. Best Regards, Giuliana
giuliana.damiani's picture
Joined: Oct 11 2013 - 1:41am
Last seen: 7 years 3 weeks ago

I tried this way and used Integer instead of collection in parameter. Now I am getting a new error

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer

Can anyone help me resolve this issue?

mailtojustine's picture
Joined: Oct 29 2015 - 6:01am
Last seen: 2 years 8 months ago