如何在报告中对多个结果集进行分组?

发布于 2024-07-08 20:01:07 字数 894 浏览 12 评论 0原文

我正在将 ActiveReports 与 ASP.NET 一起使用,但我认为任何类似的报告组件的答案都可以。

我有两个结果集要合并并显示在一个报告中,例如:

Table 1:

Name Job              Start End
Jack Some service     1992  1997
Jack Some Sales Exp   1998  2007
Jane Some programming 2000  2003

Table 2:

Name Training
Jack Shiny French Certificate
Jane Crappy database certificate
Jane Some courses in management

报告应如下所示:

Jack
  Job History:
    Some Corp, 1992-1997
    Some Sales Exp, 1998-2007
  Training History:
    Shiny French Certificate
Jane
  Job History:
    Some programming, 2000-2003
  Training History:
    Crappy database certificate
    Some courses in management

我应该如何合并两个表以及应该如何设计布局以实现给定示例中的报告?

更新:

正如您可能注意到的,我并不是尝试通过单个选择来完成此操作。 我有两个数据表作为源,我可以手动合并它们以获得单个数据源。 我正在尝试使用分组,但我需要为每个员工分配两种组。 一份用于工作,一份用于培训。 如何使用组或子报告功能来绑定此类数据(以及如果需要,我应该如何处理数据)?

I am using ActiveReports with ASP.NET but I think answer for any similar reporting component will do.

I have two resultset to merge and show in a single report, like:

Table 1:

Name Job              Start End
Jack Some service     1992  1997
Jack Some Sales Exp   1998  2007
Jane Some programming 2000  2003

Table 2:

Name Training
Jack Shiny French Certificate
Jane Crappy database certificate
Jane Some courses in management

And the report should look like:

Jack
  Job History:
    Some Corp, 1992-1997
    Some Sales Exp, 1998-2007
  Training History:
    Shiny French Certificate
Jane
  Job History:
    Some programming, 2000-2003
  Training History:
    Crappy database certificate
    Some courses in management

How should I merge the two tables and how should I design the layout to achieve the report in the given example?

Update:

As you may notice, I am not trying to do this with a single select. I have two datatables as source and I can merge them by hand to get a single data source. I am trying to use grouping but I need two kind of groups for each employee. One for the jobs, and one for the trainings. How can I use groups or sub-reports feature to bind this kind of data (and how should I process the data if necessary)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

横笛休吹塞上声 2024-07-15 20:01:07

使用子报表... 创建一个包含两个子报表的主报表。 一份工作历史子报告和一份培训历史子报告。 主报告将需要一个返回人员列表的查询。 然后,对于主报告详细信息中的每个人员,在每个子子报告上设置一个参数,该参数将优化这两个子报告中的查询,以仅列出父报告中显示的当前人员的工作历史记录或培训历史记录。

Data Dynamics 网站此处<有详细说明如何逐步执行此操作的详细演练。 /a>. 此处还提供了一些概述信息

Use subreports... Create a main report that will have two subreports. One subreport for job history and one subreport for training history. The main report will need a query that will return a list of people. Then for each Person in the detail of the main report, set a parameter on each of the child subreports that will refine the query in those two to list the Job History or Training History for only the current person being displayed in the parent report.

A detailed walkthrough that explains how to do this step by step is on the Data Dynamics website here. Some overview information is also here

爺獨霸怡葒院 2024-07-15 20:01:07

一般来说,您不能在单个 SELECT 语句中完成此操作。 大多数报告工具都提供某种“子报告”或“内部部分”,它们在不同的 SQL 问题上运行,并具有从主报告传递的一些参数。 您可以使用两个子报告和一个主报告。

In general you cannot do it in a single SELECT statement. Most reporting tools offer some kind of "subreports" or "inner sections" that run on a different SQL question and have some parameters passed from the main report. You could use two subreports and one master report.

凉世弥音 2024-07-15 20:01:07

您应该使用“左连接”选择这两个表,在报告中创建一个“GroupHeader/Footer”部分,并将“GroupHeader”部分上的“DataField”设置为字段,该字段应用作分组。

看看ActiveReports的样本,他们肯定有一个分组样本。

You should select this two tables with "left-join", create a "GroupHeader/Footer" section in report and set "DataField" on "GroupHeader" section to field, which should be used as grouping.

Look at the samples from ActiveReports, they surely has a sample for grouping.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文