December 12, 2012 at 11:28 pm
Hi all,
In my report i would like to create an optional multivalue filter for @accessVar. However my biggest problem is that available values of @accessVar makes use of wildcards. e.g 'BT%'. It will be ok if i does not allow multiple selection. But i do need multiple select. And to my knowledge i cant use IN operator with %wildcard. HELP!
Second question.
I created a report parameter named icVar(textbox style) What should i do to allow this filter to be optional. Meaning if user enter something into the textbox, will display result according to what is entered but if nothing is entered it will just treat it to display all. This is the query in my dataset
SELECT PASS_M, ENTRY_DT, EXIT_DT, WORKED_HRS, ACCESS_LOCATION_X, IC_N, COMPANY_M, CONSECUTIVE_D
FROM TEMP_TARGET
WHERE (CONSECUTIVE_D >= @consecDays) AND (ENTRY_DT BETWEEN @startDate AND @endDate) AND
(ACCESS_LOCATION_X LIKE @accessVar) AND
(IC_N LIKE @icVAr)
So i want to make icVar an optional filter. My idea is if nothing is entered, it should be LIKE '%'. I know i can add % as default value but that would be very ugly. Any smarter way?
Any help to any qns above is greatly appreciated. Thanks in advance.
Thanks,
10e5x
UPDATE: QNS 2 is solved. Thanks to hose who have tried resolving QNS 2. Now left QNS 1, Urgent, some1 help please.
Solutions to qns 2:
SELECT PASS_M, ENTRY_DT, EXIT_DT, WORKED_HRS, ACCESS_LOCATION_X, IC_N, COMPANY_M, CONSECUTIVE_D
FROM TEMP_TARGET
WHERE (CONSECUTIVE_D >= @consecDays)
AND (ENTRY_DT BETWEEN @startDate AND @endDate)
AND (ACCESS_LOCATION_X LIKE @accessVar)
AND ((@icVar IS NULL) OR (IC_N LIKE @icVAr))
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply