SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Optional cascading parameter problem


Optional cascading parameter problem

Author
Message
JackG
JackG
SSC Journeyman
SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)

Group: General Forum Members
Points: 87 Visits: 237
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?
Jack Corbett
  Jack Corbett
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43585 Visits: 14925
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
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
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