Pass comma separated list parameter from url to SQL query in .jrxml

I am appending  some values comma separated (a=1,2) and passing it to .jrxml

Example:

http://hostname:port_no/jasperserver-pro/flow.html?_flowId=anything&some......&a=1,2...(it can be of any range)

I am appending a=1,2 as a String to the url

<also tried to append as List.Didn't work!>

In .jrxml I have a SQL query which uses above parameter 'a' to query the database.

Example :

Select * from abc where a in (1,2)

In Jasper:

<parameter name="a" class="java.util.Collection" nestedType="java.lang.Integer"/>

Select * from abc where $X{IN,a,a}

======================================

But the query filtration is not happening.All the values are queried from abc table.

Please help in passing the dynamic number of parameters from url

Note:

I am appending a=1,2 in the url because,

I cannot use 'input control' because the user selection of 'a' happens in the GUI based on dynamic parameterized sql query.

 

thunderwonder100's picture
Joined: Jan 17 2018 - 3:14am
Last seen: 5 years 4 months ago

1 Answer:

I don't add parameters in URL, but I use list parameters and work perfectly for me.

Try this:

 - <parameter name="a" class="java.util.List"/>

 - Input Control with multiselect ... choice with exactly the same ID as parameter

 - $X{IN, field , parameter}

Regards,

Mariano

mlopez_1's picture
5711
Joined: Oct 21 2013 - 8:08am
Last seen: 1 month 3 weeks ago
Feedback