I have a report that uses 3 parameters:
The @startDate and @endDate parameters are working as expected. @Brand is displayed as a dropdown menu with two options: B and P
When the user selects B the results returned must match the filter: LIKE ”%.%”
When the user selects P the results returned must match the filter: NOT LIKE “%.%”
I am not sure how to make this filter work for P.
I was searching for an answer for this exact problem and I could not find. I am posting here though because I have discovered how to do it. Btw * is wildcard in SSRS
Your expression for a normal LIKE statement
=iif(variable LIKE "*.*", True, False)
Your NOT LIKE expression
=iif(NOT(variable LIKE "*.*"), False, True))
The easiest (and least elegant) option is just to have an IF statement in your SQL:
IF @Brand 'B' THEN
SELECT * FROM Table WHERE Filter LIKE '%.%'
ELSE
SELECT * FROM Table WHERE Filter NOT LIKE '%.%'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.