RDL 是否可以有可选参数或强制默认值为空 [英] RDL is it possible to have optional parameter or force default value to null
问题描述
我需要一个可选参数或一个默认值为空的参数.
I need to have an optional parameter or a parameter that's default value is null.
我想为报告使用下拉列表,该列表正在从另一个数据集获取它的值.我选择了允许 NULL 值的选项.我尝试将默认值设置为 null 以及所有其他可用设置.有什么方法可以让这个下拉菜单成为可选的,或者将默认值设为 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?
我搜索并发现了这个问题,该问题被问到并接近但没有回答可选/空问题......在报告的查询中,我确保该值是否为 NULL:SQL Server Reporting Services - 设置默认值用于多值报告参数
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)
推荐答案
您是否为数据集查询尝试过此操作:
Did you try this for your dataset query:
选择用户名作为标签,用户 ID 作为值来自 dbo.users联合所有选择所有用户",NULL
SELECT userName as Label, userId as Value FROM dbo.users UNION ALL SELECT 'All Users', NULL
然后添加一个默认值设置为空
Then add a default value set to null
这应该有效.为了重用,我经常用内联 udf 封装这个模式
This should work. for reuse, I often encapsulate this pattern with an inline udf
这篇关于RDL 是否可以有可选参数或强制默认值为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!