I have a report in which there may be multiple values being passed for a parameter named "Product_Type". So that my query becomes something like this.. "Select Id, name from temp where product_type IN ('prod1','prod2','prod3');
I am using iReport
payal
2009-10-27 04:38:09
A:
You should Product_Type set the type to java.util.List
In your SQL use the IN function :
Select Id, name from temp where $X{IN,product_type,Product_Type}
- second parameter *product_type* correspond to the name of the field in the table
- third parameter *Product_Type* correspond to the name you give in the report
If you pass an empty list, $X{IN,..,..} evaluate to a SQL "TRUE"
In the iReport, when you test the report, you see a invite box. Type :
prod1,prod2,prod3
Jmini
2009-10-28 07:51:25
This query doesn't work...gives an errorSELECT rownum,REPORTING_MON_YEAR,PROD_TYPEFROM temper_tstwhere $X{IN,PROD_TYPE,product}AND Upper(MONTH) Like Upper('$P!{month}%')AND Upper(YEAR) Like Upper('$P!{year}%')
payal
2009-10-28 09:25:58
I don't know what your engine is, but be careful because I think that it is case sensitive. You have fields named rownum,REPORTING_MON_YEAR,PROD_TYPE in the same table ?Try to identify why it do not work... If your SQL engine provide a monitor console, look at the query sent by iReport. You also can try to reduce the query :1) SELECT rownum,REPORTING_MON_YEAR,PROD_TYPE FROM temper_tst;2) SELECT rownum,REPORTING_MON_YEAR,PROD_TYPE FROM temper_tst where $X{IN,PROD_TYPE,product};(if you have a big set, also add LIMIT 10)
Jmini
2009-10-28 14:12:58