ssrs 报告 2008 选择 1 或其他参数

ssrs report 2008 pick 1 or other parameter

在 ssrs 2008 报告中,我有一个用户有时想要 select 2 个不同的参数。

有时用户想要: 1. select 只有邮政编码, 2. select 只有城市和州,或者 3. select 邮政编码和城邦组合。

在 SSRS 2008 报告中,我看不出这怎么可能?如果我错了你会让 我知道如何实现这个目标吗?

如果这不可能,我能看到的唯一选择是创建另一个参数,其中 选项是 select: 1. select 只有邮政编码, 2. select 只有城市和州,或者 3. select 邮政编码和城市声明组合。 一旦此选项被 selected,那么适当的选项将是: 请求的参数是否可供请求。

让我知道你的建议是最好的选择。

我会有两个过滤器(实际上城市和州是分开的,所以三个)并允许它们为 NULL。

如果你想在查询中根据你的参数进行过滤,你可以添加 where 子句来匹配参数,除非它是 NULL:

SELECT * 
FROM TABLE 
WHERE (ZIP = @ZIP OR @ZIP IS NULL)
   OR (
       (CITY = @CITY OR @CITY IS NULL)
      AND
       (STATE = @STATE OR @STATE IS NULL)
      )

如果您想使用表达式在 SSRS 中进行过滤,则需要将它们组合在一个 IIF 中:

=IIF(Fields!ZIP.Value = Parameters!ZIP.Value AND NOT ISNOTHING(Parameters!ZIP.Value), 1,   
 IIF(Fields!CITY.Value = Parameters!CITY.Value AND NOT ISNOTHING(Parameters!CITY.Value) AND Fields!STATE.Value = Parameters!STATE.Value AND NOT ISNOTHING(Parameters!STATE.Value), 1, 0)) 

并设置匹配为1

这读作

If the ZIP equals the ZIP parameter and the ZIP parameter is NOT NULL then YES

Else

If the City and State fields equal their parameter and aren't NULL then Yes

Else NO.