简体   繁体   English

SQL Server Reporting Services 主/详细报表

[英]SQL Server Reporting Services Master/Detail Report

I have a report which has a tablix as the master report with a sub report which relies on two fields from the master report.我有一个报告,它有一个 tablix 作为主报告,还有一个子报告,它依赖于主报告中的两个字段。 When the master report is opened, the sub report is displayed correctly.打开主报表时,子报表正确显示。 However, the sub report is not updated when I click on the next row in the master report;但是,当我单击主报告中的下一行时,子报告不会更新; I would expect it to be refreshed based on the values of the two parameter fields.我希望它根据两个参数字段的值进行刷新。

I think you are misunderstanding how subreports work and what they are intended for.我认为您误解了子报表的工作方式以及它们的用途。

As stated in the MSDN documentation :正如MSDN 文档中所述

A subreport is a report item that displays another report inside the body of a main report.子报表是在主报表正文中显示另一个报表的报表项。 Conceptually, a subreport in a report is similar to a frame in a Web page.从概念上讲,报表中的子报表类似于网页中的框架 It is used to embed a report within a report.它用于在报表中嵌入报表。

Typically we use subreport(s) when creating a main report that acts as a container for one or more related reports.通常,我们在创建主报表时使用子报表,该主报表充当一个或多个相关报表的容器。 This is not the same as Master/Detail in the way that you are understanding it.这与您理解的主/细节不同。 For what you require to work, SSRS would have to be capable of refreshing the subreport independently within the body of the main report.对于您需要的工作,SSRS 必须能够在主报告正文中独立刷新子报告。 And it simply cannot do that.它根本无法做到这一点。

What are your options?你有哪些选择?

  1. Create a drillthrough report by defining an Action on a textbox or placeholder so that when the clicks on it they are taken to a new report showing the detail.通过在文本框或占位符上定义操作来创建钻取报告,以便在单击时将它们带到显示详细信息的新报告。 Clicking the back button in the report toolbar returns them to the main report.单击报告工具栏中的后退按钮将它们返回到主报告。
  2. Merge your queries to create a single report.合并您的查询以创建单个报告。 You can then use grouping and toggle items, creating a drilldown report, allowing your users to interactively hide/show detail rows as desired.然后您可以使用分组和切换项目,创建一个钻取报告,允许您的用户根据需要以交互方式隐藏/显示详细信息行。

Of the two, I would recommend the second approach.在这两种方法中,我会推荐第二种方法。 In my experience users too easily confuse the SSRS toolbar back button with the browser back button.根据我的经验,用户很容易将 SSRS 工具栏后退按钮与浏览器后退按钮混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM