Search code examples
sqljasper-reports

Passing parameters to `In` clause


I am trying to pass parameters to Jasper report In clause. Below is what I tried in Jasper reports.

SELECT * FROM `medication` WHERE $X{IN,idMeidication,$P!{parameter_name}}

However it is keep on saying the parameter_name does not exists. If I convert my Jasper SQL to normal SQL, it will look like this

SELECT * FROM `medication` WHERE idMedication IN (1,2,3)

I am using Jaspersoft Studio and how can I fix this?


Solution

  • I think the right solution will be:

    SELECT * FROM `medication` WHERE $X{IN,idMeidication,parameter_name}
    

    without $P!{}

    In this way i use it in my reports.