问题描述
我有一份 SSRS 报告,其中包含多个向下钻取级别.数据是针对顶级视图汇总的,但我需要根据其中一列的类型显示不同的向下钻取报告.
I have an SSRS report with several levels of drilling down. Data is aggregated up for the top level view, but I need to show a different drill down report depending on the type of one of the columns.
例如:
表 1 - 苹果
Name Cost
Fuji 1.5
Gala 3.5
表 2 - 南瓜
Name Cost
Pumpkin 2
Gourd 4.5
我有一个存储过程,它聚合这些并将它们放在一个表中以供顶级报告显示.即:
I have a stored procedure which aggregates these and puts them in a table for the top level report to show. Ie:
Name Cost ItemType
Apples 5 1
Squashes 6.5 2
实际上,这两个表具有不同的列,我需要在钻取报告中显示这些列.是否可以查看 ItemType 列并根据其值深入到两个子报告之一?
In reality, the two tables have different columns which I need to show in the drill through reports. Is it possible to look at the ItemType column and either drill down to one of two sub-reports, depending on it's value?
推荐答案
如果您需要在两个或多个不同的子报表之间进行选择,请将文本框上的操作的 ReportName 属性设为这样的表达式.
If you need to choose between two or more different sub-reports then make the ReportName property of the action on the textbox an expression like this.
=IIF(Fields!ItemType.Value = 1, "subReport_Apples", "subReport_Oranges")
如果你有多个 SWITCH 可能会更好
if you have more than a handful SWITCH will probably be better
= SWITCH (
Fields!ItemType.Value = 1, "subReport_Apples",
Fields!ItemType.Value = 2, "subReport_Oranges",
Fields!ItemType.Value = 3, "subReport_Lemons",
True, "subReport_AnythingElse"
)
如果您有很多项目类型,请考虑将子报表的名称添加到您的数据库中,以创建一个包含 ItemType
和 subReportName
的新表.然后,您可以在查询中加入该查询并获取实际的子报表名称.文本操作的 ReportName 属性将是 Fields!SubReportname.Value
If you have a LOT of item types, consider adding the names of the subreports to your database creating a new table containing ItemType
and subReportName
. You can then join to this in your query and get the actual subreport name. The ReportName property of the text action would then simply be Fields!SubReportname.Value
这篇关于每行不同的钻取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!