views:

42

answers:

2

I need to have an optional parameter or a parameter that's default value is null.

I want to use a dropdown list for a report, the list is getting it's values from another dataset. I have selected the option to allow NULL values. I have tried setting the default value to null and all the other settings available. Is there some way to make this dropdown optional or have the default value as NULL?

I've searched and found this question that was asked and comes close but does not answer the optional/null question...In the query for the report I am making sure the value is either NULL or not: http://stackoverflow.com/questions/1877191/sql-server-reporting-services-set-default-value-for-multi-value-report-parameter

(@assignedTo is null or @assignedTo = [User].UserInfo.FirstName +' '+ [User].UserInfo.LastName) 
+1  A: 

Since I can't seem to do what I want (and no one gave ANY advice), setting the first value in the dropdown to NULL..I've come up with a better solution, hopefully.

I'm going to create a class that creates the dataset and adds the NULL value to the collection. Then add that collection to the report..I hope this will work. This way it's great for reusability..etc.

Avien
+1  A: 

Did you try this for your dataset query:

SELECT userName as Label, userId as Value FROM dbo.users UNION ALL SELECT 'All Users', NULL

Then add a default value set to null

This should work. for reuse, I often encapsulate this pattern with an inline udf

JasonHorner
I was just talking about that option with a co-worker. It does seem the easiest and best solution to the issue. ty for your response :)
Avien