views:

219

answers:

2

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');

A: 

whether u r using ssrs report for doing this?

Raj
I am using iReport
payal
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
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
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