JasperReports: How to create a parameter which takes multiple values as input

前端 未结 1 1343
说谎
说谎 2020-12-09 22:58

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:

相关标签:
1条回答
  • 2020-12-09 23:41

    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

    0 讨论(0)
提交回复
热议问题