English 中文(简体)
Reporting Services 2005过滤器
原标题:
  • 时间:2009-04-13 20:10:05
  •  标签:

有办法”和“”或“过滤器在SSRS 2005 ?

我有一个表指向一个数据集(存储过程)看起来像这样:

    name                       type                 amount 
License Plate Credit           fees                ($150.00) 
Lieu Tax                       fees                $1,012.12 
Finance Tax City               taxes               $1,839.90 
Finance Tax County             taxes               $306.65 
Finance Tax State              taxes               $3,434.48 

用户希望看到所有行:

  1. type = taxes or
  2. type = fees and name = Lieu Tax

The reason I need to do this in the report and not in the stored procedure is because we will be creating multiple reports pointing to the same stored procedure depending on how each client wants to lay out the display and business rules.

Requirements Clarification I was hoping there was a way to do it in the report instead of the proc. The plan is to have many custom reports pointing to the same proc with different requirements. The idea was for report builders (who don t know SQL) to create the reports instead of us programmers always having to get involved.

最佳回答

每个可能的条件组合是通过或失败。你用一个开关来评估每一个可能的条件,并返回一个1或者0。然后使用一个“=”和“= 1”过滤条件。

=SWITCH (TYPE = "TAXES", 1, TYPE = "FEES" AND NAME = "Lieu Tax"), 1, 1=1, 0 )

你可以处理整个过滤在单个表达式。就像一个魅力。

问题回答

你应该修改你的存储过程接受参数类型和名称,然后从你的报告应该调用这个存储过程根据用户需求有正确的价值观。报告服务报告有一个特性称为报表参数。因此,你应该把你的报告接受来自用户的类型和名称的参数和通过在存储过程。为多个用户创建多个报告,你会从这个模板创建多个链接的报告报告时使用不同的参数值。

proc更改

SELECT 

xxx

FROM

xxx

WHERE (a.id = @aID OR @aID IS NULL)
AND   (b.id = @bID OR @bID IS NULL)
AND   (c.id = @.....

传递一个值或空的报告

Yes there is. Open the table properties for the table or matrix with the data. There s a filters tab there allowing you to filter data after the query has been executed.





相关问题
热门标签