RDL is it possible to have optional parameter or force default value to null

邮差的信 提交于 2019-12-11 00:35:33

问题


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: SQL Server Reporting Services - Set default value for multi-value report parameter

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

回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/3215350/rdl-is-it-possible-to-have-optional-parameter-or-force-default-value-to-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!