Multi selection input control

0

Hello everybody,

i just created a very simple report where i extract a bunch of attributes from a table based on a WHERE condition like this:

WHERE field_name = $P{string parameter}

Everything works fine but now i need to make another report using a multi selection list input control so the user can select more than one attribute to match the field name, i can create the input control on jasperserver but when i run the report it display that the report is empty even if i select just one option, can anybody put me on the right direction about this, the report is created on Ireports.

Best regards!

 

MikeM19's picture
41
Joined: Jan 5 2015 - 1:42pm
Last seen: 7 months 2 weeks ago

The where clause changes when doing more of an IN statement. It would be Where $X{IN,field_name,string parameter} but the Parameter Class needs to be changed from a string to a java.util.Collection. Defaults can be assigned there as well.

This is one I use:

Where $X{IN,agent_name,agent_namelist}

agent_name is my table column and agent_namelist is the parameter I use as a collection for the in statement.

joel.carlson - 4 years 7 hours ago

I just have to say, you saved my life today, it works perfectly thank you so much Joel.

 

Regards!

MikeM19 - 4 years 4 hours ago

No problem Mike, someone else just saved mine so it all goes around.  Glad to help, had the same issue and struggled through that one.

joel.carlson - 4 years 2 hours ago

1 Answer:

0

The where clause changes when doing more of an IN statement. It would be Where $X{IN,field_name,string parameter} but the Parameter Class needs to be changed from a string to a java.util.Collection. Defaults can be assigned there as well.

This is one I use:

Where $X{IN,agent_name,agent_namelist}

agent_name is my table column and agent_namelist is the parameter I use as a collection for the in statement.

joel.carlson's picture
Joined: Jul 23 2015 - 4:39pm
Last seen: 1 month 1 week ago
Feedback
randomness