【问题标题】:SSRS Parameter with an Either Or condition带有非此即彼条件的 SSRS 参数
【发布时间】:2015-12-07 23:50:56
【问题描述】:

我正在尝试在 SSRS 中实现一个参数,其条件为非或。换句话说,我的 Branch 参数应该能够搜索或查找任何分支或多个分支,或者将其保留为 NULL 或空白。同样,我的 RepCode 参数应该能够搜索或查找任何 repcode 或多个 repcode,或者将其保留为 NULL 或空白。

目前,我将分支设置作为必需,并将 repcode 设置作为通配符搜索

我尝试过使用“允许多个值”,但如果不输入值就无法使其正常工作。我希望能够在分支参数中输入值或留空,而是在 repcode 参数中输入值并返回数据。我需要branch in (@branch) and repcode in (@repcode) 来完成这项工作吗?

如果我将分支或复制代码留空,我会收到以下错误。

业务用户希望能够输入repcode并将分支留空,或者输入分支并将repcode留空,并且能够在两个参数中随意输入多个值。

有没有办法在 SSRS 中做到这一点?

谢谢,

【问题讨论】:

    标签: reporting-services ssrs-2008 ssrs-2008-r2


    【解决方案1】:

    使这些参数在 SSRS 中可以为空

    在您的 SQL 查询中使用此模式

    WHERE (branch in (@branch) and (@branch is not null and @repcode is null))
      OR (repcode in (@repcode) and (@repcode is not null and @branch is null))
      OR (branch in (@repcode) and repcode in (@repcode) and (@branch is not null and @repcode is not null))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-06
      • 2021-08-09
      相关资源
      最近更新 更多