Looping through a multiple value parameter array

前端 未结 3 1441
长情又很酷
长情又很酷 2021-01-13 11:06

I have a parameter that allows multiple values. Its for a name field in my database. What I want to be able to do is allow the user to put in a name and then have crystal fi

3条回答
  •  终归单人心
    2021-01-13 11:37

    Another approach (I thought it made sense to create a separate answer), if you have Oracle, is to make use of the REGEXP_LIKE expression.

    • Create a report that uses a Command.
    • Create a string parameter ({?QUERY}) in the Command's panel; set the default value to 'ALL' (without single quotes).
    • Add the query to the Command; reference the parameter:

    SELECT customer_name FROM customers WHERE ( '{?QUERY}'='ALL' OR REGEXP_LIKE(customer_name, '{?QUERY}') )

    • Add fields to the report as usual
    • When prompted (running the report), enter a regular expression in the QUERY parameter. The pattern 'A|B|C' is equivalent to LIKE '%A%' OR LIKE '%B%' OR LIKE '%C%'.

提交回复
热议问题