Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Creating Optional Filters in SSRS 2005 Expand / Collapse
Author
Message
Posted Wednesday, December 12, 2012 11:28 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, February 2, 2013 11:09 AM
Points: 97, 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))
Post #1396000
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse