简体   繁体   English

JasperReports 中子报表的替代方案

[英]Alternative to subreports in JasperReports

I am using JasperReports in my project.我在我的项目中使用 JasperReports。 During the generation of reports, I am forced to retrieve data from different tables in the database.在生成报告期间,我被迫从数据库中的不同表中检索数据。 I have used subreports, but this solution is not satisfactory for me.我使用过子报表,但这个解决方案对我来说并不令人满意。 Main reason for this is fact that for each report I have to prepare two jrxml files.主要原因是我必须为每个报告准备两个 jrxml 文件。 For the assumptions of my project this is not effective.对于我的项目的假设,这是无效的。

Is there an alternative to subreports?有没有子报告的替代品? If it is important I use Hibernate.如果很重要,我使用 Hibernate。

Mateusz, you can prepare data source manually in java code and pass is to the report. Mateusz,您可以在 java 代码中手动准备数据源并传递给报告。 Sometimes the good subreport's alternative is using group(s) in report.有时,好的子报表的替代方法是在报表中使用组。

At a higher level what are you trying to achieve?在更高的层次上,你想要达到什么目的?

If the reason you're using subreports is to embed mulitple graphs/chart widgets that display different but related data, then an alternative way to doing this is using subdatasets如果您使用子报表的原因是嵌入多个显示不同但相关数据的图形/图表小部件,那么另一种方法是使用子数据集

Innformation on using subdatasets can be found in iReport Ultimate Guide, but basically they are extra sub queries you can run in addition to the main report query, whose results can be access by Charts/Charts Pro widgets (see the chart data tab in these widget properties)关于使用子数据集的信息可以在 iReport Ultimate Guide 中找到,但基本上它们是除了主报表查询之外您可以运行的额外子查询,其结果可以通过 Charts/Charts Pro 小部件访问(请参阅这些小部件中的图表数据选项卡特性)

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

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