【问题标题】:Issue with adding independent filters search to multiple parameters in SSRS向 SSRS 中的多个参数添加独立过滤器搜索的问题
【发布时间】:2020-06-01 16:58:47
【问题描述】:

我一直在尝试创建具有多个参数的报告。我的要求是在搜索报告时将这些参数彼此分开。 in this picture we have four input values but they are codependent which each other and the requirement says the client should be able to see the data with one filter input 谁能帮我区分这些单独的搜索者。

【问题讨论】:

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


    【解决方案1】:

    这取决于您的参数是否相关。如果是,请编辑您的问题,我会更新答案。

    但是作为一般规则,您应该将所有参数设置为允许 NULL

    然后在您的数据集查询中,您的查询将类似于

    SELECT * 
        FROM myTable
        WHERE (
            (region IN (@region) or @region IS NULL)
            AND
            (cocode IN (@cocode) or @cocode IS NULL)
            AND
            (prodcode IN (@prodcode) or @prodcode IS NULL)
            AND
            (datetimestamp IN(@datetimestamp) or @datetimestamp IS NULL)
            )
    

    我在这里使用了IN,以防您的参数允许多个值,如果它们不允许,这仍然可以工作,但是您可以将 where 子句的每个部分更改为例如 (region = @region or @region IS NULL)

    如果这没有帮助,请发布您的数据样本和每个参数值的样本,包括它们之间的任何关系。

    【讨论】:

      【解决方案2】:

      所有这些值都来自同一个表,我们必须这样做,因为我们需要表中的不同值。当我只选择一个参数时,我尝试了这个查询并报告仍然没有给出任何结果。选择 * FROM data_table_name 斧头 在哪里 ( (区域 IN (@region) 或 @region 为 NULL) 和 (代码输入(@cocode)或@cocode 为空) 和 (产品代码输入(@prodcode)或@prodcode 为空) 和 (CONVERT(VARCHAR(10), datetimestamp, 110) IN (@datetimestamp) 或 @datetimestamp IS NULL) )This is how i structured my report

      【讨论】:

      • 您需要删除此答案并编辑您的原始问题而不是添加答案,还请显示您的表格中的一些示例输出data_table_name
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      相关资源
      最近更新 更多