简体   繁体   English

将所有参数添加到SSRS报告

[英]Adding an ALL Parameter to SSRS report

I have a query that I use for a parameter for some reports in SSRS. 我有一个查询,该查询用于SSRS中某些报告的参数。 I would like to add an Select ALL option to this parameter. 我想向该参数添加一个全选选项。 Does that mean that I will need to add another query for my list? 这是否意味着我需要为列表添加另一个查询? Is there a better way to go about doing this? 有没有更好的方法可以做到这一点? If I go this route I think I will need to modify all of my reports. 如果我走这条路,我想我需要修改所有报告。

select EmployeeName,
EmployeeID as EmployeeKey
from dimEmployee
where EmployeeID in ('9','3','4','81','115','68','11' )
order by EmployeeName

The way I typically do this is to UNION a NULL record onto the dataset that populates the list of possible values, then 我通常这样做的方法是将NULL记录UNION到填充可能值列表的数据集上,然后

select EmployeeName,
EmployeeID as EmployeeKey
from dimEmployee
where EmployeeID in ('9','3','4','81','115','68','11' )
UNION ALL 
SELECT 
  ' ALL ',
  NULL
order by EmployeeName

Then in your report query, handle the case where EmployeeID is NULL : 然后在报表查询中,处理EmployeeID为NULL的情况:

SELECT ...
FROM ...
WHERE @EmployeeID IS NULL OR EmployeeID IN (@EmployeeID)

So yes, you will need to modify all of your reports. 因此,是的,您将需要修改所有报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM