SSRS:如何将所有选项添加到 SSRS 下拉过滤器?
我使用的是 SQL Server Reporting Services for SQL 2008 R2.我的报告由两个从表格填充的下拉菜单过滤,其中一个显示版本号.我想让用户可以选择全部",从而返回所有内部版本号的数据,而不仅仅是一个.如何将此选项添加到我的下拉过滤器并使其正常工作?非常感谢您提供的任何帮助.J.
I'm using SQL Server Reporting Services for SQL 2008 R2. My reports are filtered by two drop-down menus that are populated from a table, one of them displays a build number. I'd like to give users the option to choose "All" and so return data for all build numbers and not just one. How do I add this option to my drop-down filter and make it work correctly? Thanks very much for any help provided. J.
我假设您不想在这里使用多值参数,您只想让用户针对所有构建或只是一个,而不是构建的选择.否则,您只需使用标准的多值参数.
I'm assuming you don't want to use a multi-value parameter here, you only want users to run against all builds or just one, not a selection of builds. Otherwise you'd just use a standard multi-value parameter.
一种方法是为参数数据集中的所有构建返回一个额外的行,例如类似:
One way to do this is to return an extra row for all builds in your parameter dataset, e.g. something like:
select buildId as null, build = 'All'
union all
select buildId = build, build
from builds
我在这里返回两列,这样我们就可以传递一个 NULL 值参数,但仍然有一个用户友好的描述来显示在报告中.
I'm returning two columns here so we can pass a NULL value parameter but still have a user-friendly description to display in the report.
将此设置为您的参数数据集.在报告代码中,您可以使用参数执行以下操作:
Set this up as your parameter dataset. In the report code you can then use the parameter to do something like:
select *
from builds
where (@build is null or @build = build)
@build
为空时返回所有构建,@build
不为空时返回指定构建.
Which will return all builds when @build
is null and a specified build if @build
is not null.