Collection parameter with X{IN, col, values} issue



I am trying to pass a Collection parameter as Input control to a report to be used in a query with the X{IN, col, values} structure.

Relevant information:

Parameter definition: <parameter name="incidentCategories" class="java.util.Collection"/>

Query condition: AND $X{IN,, incidentCategories}

It doesn't work because for some reason the SQL parsing uses the first value in the collection, found in logs:

AND IN (?)

AND DATE(incident.created) >= ?
AND DATE(incident.created) <= ?
2012-11-07 13:54:55,108 DEBUG JRJdbcQueryExecuter,pool-1-thread-5:362 - Parameter #1 (SLA of type java.lang.Long): 27
2012-11-07 13:54:55,109 DEBUG JRJdbcQueryExecuter,pool-1-thread-5:423 - Parameter #2 (incidentCategories[0] of type java.lang.String): 1
Can somebody explain to me how to use it properly?
Best regards,
adrian_852's picture
Joined: Nov 2 2012 - 7:03am
Last seen: 7 years 3 months ago

1 Answer:


Does your incidentCategories input control return numerical values?  If so, try setting nestedType="java.lang.Integer" (or Long) for the report parameter.



lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 3 days 1 hour ago
Worked like a charm! Fantastic! Thanks!
adrian_852 - 7 years 3 months ago

I have almost the exact same issue as posted in :

The only difference is my parameter is referencing string datatype not integer.

I also observe that the input control only returns a single input, instead of a list of options as expected from a collection.

For reference, I'm running Jaspersoft Studio (ce) 6.3. and my Jasper Server environment is Pro version 6.1.1.

my WHERE clause is
$X{IN, ActivityLabel, msactlab}

parameter name "msactlab" is setup as a multi select query on server.

I've specified class as "java.util.Collection"
and nested type as "java.lang.String"

The input control dialog box shows up when I run the report in Server.
But just like the post referenced above, I only see an single option, not the full list I would expect.

If this helps, some of the entries in the column "ActivityLabel" are null, so please let me know if I need to try an alternate syntax.

--> I tried searching the community site before posting this.

I also looked at this post for help:

No luck so far.

Any and all assistance would be greatly appreciated.

nubius - 3 years 3 months ago