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

Optional cascading parameter problem Expand / Collapse
Author
Message
Posted Wednesday, April 16, 2014 11:52 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 17, 2014 2:17 PM
Points: 44, Visits: 171
This is in SSRS 2012

I'm having problems trying to make a cascading parameter optional. The report requirements are that the user can enter an employee ID and run the report, or enter part/all of the last name to get a drop down list of employees to select from.



Right now I can't get it configured so an ID can be entered and then hit view report. When I do that it throws an error requesting a value be entered for the 'Select Employee From List'.



The Employee parameter (which is behind the 'Select employee from list') is setup to get it's values from a query. The query gets name and ID values based upon the string entered in the 'last name contains'. I have tried setting up the Employee parameter to allow NULL and/or blank values. I have tried setting up a default value for the parameter. When I put in a default for the parameter, I still had to actually select the default in order for it to work.

I also tried setting the 'Last Name Contains' variable so that it can be NULL and checked the NULL which did not change anything.

What am I missing?
Post #1562404
Posted Thursday, April 17, 2014 10:58 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:07 AM
Points: 11,157, Visits: 12,899
I'd probably handle this by making the query for Select Employee From List Parameter an expression something like this:

=IF(Parameters!EmployeeID.Value = String.Empty, "Select ID, Name From dbo.Employee where Name Like '%'" & Parameters!Name.Value & "'", "Select " & Parameters!EmployeeID as ID, 'None' As Name")


OR

="Select ID, Name From dbo.Employee where " & IF(Parameters!EmployeeID.Value = String.Empty, " Name Like '%'" & Parameters!Name.Value & "'", " ID = " & Parameters!EmployeeID.Value)




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1562781
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse