简体   繁体   English

Jasper报告-哈希图或子报告

[英]Jasper Report — Hashmap or Sub report

The back end of Java application can return a series of tables, every table is with the same structure, just like search for "information of schools which in specific area" can return dynamic amount of schools with its information, now we want to make each school detail as a table. Java应用程序的后端可以返回一系列表,每个表都具有相同的结构,就像搜索“特定区域的学校信息”可以返回带有其信息的动态学校数量一样,现在我们要使每个学校详细信息作为表格。

-School A-
=============================
Name | Address | Student Name

-School B-
=============================
Name | Address | Student Name

....

-School N-
=============================
Name | Address | Student Name

Then can we use HashMap in Jasper to save the trouble of sub report and still keep everything dynamic ? 然后,我们可以在Jasper中使用HashMap来节省子报表的麻烦,并且仍然保持所有动态吗? Any hint is grateful. 任何提示是感激的。

Can you return all the data in one table (you say that thet tables you now get have the same structure)? 您能否在一个表中返回所有数据(您说现在获得的表具有相同的结构)?

If not directly from a database then write your own data source class that would wrap all the tables into one data source for Jasper. 如果不是直接来自数据库,则编写您自己的数据源类,该类会将所有表包装到Jasper的一个数据源中。

Then put the data to the detail of the report and tell Jasper to do grouping on School column. 然后将数据放入报告的详细信息,并告诉Jasper在School列上进行分组。

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

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