Jump to content

how to use multiple value parameter & WHERE ... IN


shymaza

Recommended Posts

 Hi! 

I have an multi-value query input control in jasperserver, pass values to Collection type parameter. I need to pass this values to WHERE ... IN (value1,value2,.. valueN) in report SQL query.

If use 

WHERE XXX IN $P{COLLECTION_TYPE_PARAMETER} 

it shows error: 

Parameter type not supported in query : COLLECTION_TYPE_PARAMETER class java.util.Collection

How can I do IT? 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

shymaza,

In general the easiest way to use multiple values with an IN clause is to use the $X{} syntax.

The basic idea is this:
SELECT ... WHERE $X{IN, MyColumn, MyCollectionParameter}

There's a sample supplied with JasperReports and iReport: /demo/samples/query. You'll find good examples searching in this forum and the JasperServer forum too.

Regards,
Matt

Link to comment
Share on other sites

  • 3 years later...

I resolved this issue finally ... The reason why it was throwing error is

My iReport Langauge property is set to "Groovy" instead of "Java"

NOT in tools-> Options-> Language- Java

BUT for Language in Activity Report Properties ->Language ->Java (THIS IS THE CHANGE that resolved my issue)

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...