Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Creating Optional Filters in SSRS 2005


Creating Optional Filters in SSRS 2005

Author
Message
10e5x
10e5x
SSC-Enthusiastic
SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)

Group: General Forum Members
Points: 109 Visits: 180
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))

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search