在SSRS中向多个参数添加独立过滤器搜索的问题

问题描述 投票:0回答:2

我一直在尝试创建具有多个参数的报告。我的要求是在搜索报告时将这些参数彼此分开。 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
2个回答
0
投票

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

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

enter image description here

然后在数据集查询中,查询看起来像

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)

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


0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.