简体   繁体   English

如何在 SSRS 2017 中执行多个报告

[英]How to execute multiple reports in SSRS 2017

[![enter image description here][1]][1]I have an SSRS 2017 report that consists of a main report and multiple sub reports. [![在此处输入图片描述][1]][1]我有一份 SSRS 2017 报告,它由一个主报告和多个子报告组成。 This report is published to the SSRS Portal, and then called by a web application.此报告发布到 SSRS 门户,然后由 Web 应用程序调用。 The report currently accepts one parameter from the web application, ie Case ID.该报告当前接受来自 Web 应用程序的一个参数,即案例 ID。 My task is to allow the web application to pass multiple Case IDs, and the report will then be executed multiple times, each for a Case ID.我的任务是允许 Web 应用程序传递多个案例 ID,然后报告将执行多次,每次针对一个案例 ID。 If I pass multiple Case IDs to the main report, the outcome is that each sub report will be repeated multiple times.如果我将多个案例 ID 传递给主报告,结果是每个子报告将重复多次。 Let's say, I pass case ID 100 and 101 to the report, the outcome would be something like this: Sub-Report-A-Case-100, Sub-Report-A-Case-101, Sub-Report-B-Case-100, and Sub-Report-B-Case-101, so on and so forth.假设我将案例 ID 100 和 101 传递给报告,结果将是这样的:Sub-Report-A-Case-100、Sub-Report-A-Case-101、Sub-Report-B-Case- 100 和 Sub-Report-B-Case-101,依此类推。 The ideal scenario would be Sub-Report-A-Case-100, Sub-Report-B-Case-100, Sub-Report-A-Case-101, etc. Since the report is called from a web application, I cannot use data-driven subscription features.理想的情况是 Sub-Report-A-Case-100、Sub-Report-B-Case-100、Sub-Report-A-Case-101 等。由于报告是从 Web 应用程序调用的,我不能使用数据驱动的订阅功能。 What other options do I have?我还有什么其他选择?

Please advise.请指教。 Thanks, Jay谢谢,杰

Assuming you have a list of case id's and you have a multi-value parameter called @CaseID then I would do it as follows...假设您有一个案例 ID 列表,并且您有一个名为@CaseID的多值参数,那么我将按如下方式执行...

In you main report:在您的主要报告中:

Create a dataset and call it dsCases for example, with a query something like创建一个数据集并将其dsCasesdsCases ,例如,使用类似的查询

SELECT DISTINCT CaseID FROM WHERE CaseID IN (@CaseID) ORDER BY CaseID

This will give you small dataset with 1 row per case.这将为您提供每个案例 1 行的小数据集。

Next add a table to your report and remove all but one column.接下来在您的报告中添加一个表格并删除除一列之外的所有内容。 (You can remove additional rows too leaving a single 'cell'. Set the datset property of this tablix to dsCases (您也可以删除其他行,留下一个“单元格”。将此 tablix 的 datset 属性设置为dsCases

In the remaining cell, right-click and insert a subreport.在剩余的单元格中,右键单击并插入子报表。 Set the subreport parameters as required (point it to Sub-Report-A), passing the CaseID field as the parameter value ( Fields!CaseID.Value ).根据需要设置子报表参数(将其指向 Sub-Report-A),将 CaseID 字段作为参数值 ( Fields!CaseID.Value ) Fields!CaseID.Value

Copy and paste the entire table and align it under the first one.复制并粘贴整个表格并将其与第一个表格对齐。

Change the subreport properties of the subreport in the second table to point to your second sub report (Sub-Report-B).将第二个表中子报表的子报表属性更改为指向您的第二个子报表 (Sub-Report-B)。

This will generate a "Sub-Report-A" for each case in the dataset and then it will repeat for "Sub-Report-B".这将为数据集中的每个案例生成一个“子报告-A”,然后为“子报告-B”重复。 If this does not work, let me know and I will post a full answer with screenshots.如果这不起作用,请告诉我,我将发布带有屏幕截图的完整答案。

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

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