用于显示多对一关系的组

时间:2011-03-11 14:18:49

标签: jasper-reports report ireport

我需要在iReport中创建一个JasperReport,列出员工信息,包括学位和证书信息。 我的查询返回了我需要的所有数据(我认为),但我无法弄清楚如何在IReport中执行组和/或细节,以便它显示为我需要的。

这是我的问题:

select e.eid, e.first_name, e.last_name, 
       d.degree_date, d.degree_name, 
       c.cert_date, c.cert_name
from employees e, degrees d, certifications c
where e.eid = d.eid
and e.eid = c.eid

以下是结果:

1234, John, Smith, 01/01/2010, MCSE, 4/4/2001, B.S. Information Systems
1234, John, Smith, 01/01/2010, MCSE, 5/5/2004, M.S. Comupter Science
1234, John, Smith, 03/01/2010, CISSP, 4/4/2001, B.S. Information Systems 
1234, John, Smith, 03/01/2010, CISSP, 5/5/2004, M.S. Comupter Science
1235, John, Rolph, 01/01/2010, Pottery Instruction, 6/6/2001, B.A. Fine Arts 
1235, John, Rolph, 01/01/2010, Pottery Instruction, 7/7/2004, M.S. Education
1235, John, Rolph, 03/01/2010, Adv Pottery, 6/6/2001, B.A. Fine Arts
1235, John, Rolph, 03/01/2010, Adv Pottery, 7/7/2004, M.S. Education

我需要报告显示如下:

Employee ID Employee Name
1234    John Smith
        Certifications:
        01/01/2010 MCSE
        03/01/2010 CISSP
        Degrees:
        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

1235    John Rolph
        Certifications:
        01/01/2010 Pottery Instruction
        03/01/2010 Adv Pottery
        Degrees:
        6/6/2001 B.S. B.A. Fine Arts
        7/7/2004 M.S. Education     

如果您有任何建议,请告诉我。

1 个答案:

答案 0 :(得分:1)

正如DaDaDom建议的那样,使用一个报告和两个子报告:

报告1 - 人

1234    John Smith

子报告1.1 - 证书

        01/01/2010 MCSE
        03/01/2010 CISSP

子报告1.2 - 度

        4/4/2001 B.S. Information Systems
        5/5/2004 M.S. Comupter Science

综合结果

然后:

  1. 将一个组乐队添加到主报告中。
  2. Group By员工ID。
  3. 在组频段中包含“证书”子报告。
  4. 在Group band中包含Degrees子报告。
  5. 将员工ID从主报表传递到子报表。
  6. 让每个子报表根据收到的员工ID参数查询必要信息。