了解 JasperReports 和 JRBeanCollectionDataSource [英] understanding JasperReports and JRBeanCollectionDataSource

查看:34
本文介绍了了解 JasperReports 和 JRBeanCollectionDataSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我的 JRBeancollectionDataSource 中的 JasperReports 在我的代码中工作!我只是对一些事情有点困惑......

I now have my JasperReports working from my JRBeancollectionDataSource in my code! I am just a bit confused about some things...

当我在 iReport 中设计报告时,我从查询中创建字段,这一切我都可以做得很好,因为当我实际运行查询时,我使用的是 aa 代码 JRBeanCollectionDataSource 那么此时报告中的 hql 是否完全不相关?

When I am designing reports in iReport, I create the fields from a query, which I can do fine and all, since when I am actually running the query I'm using a a code JRBeanCollectionDataSource and so is the hql in the report totally irrelevant at this point?

另外,我在为报表提取的对象中有其他持久对象的 List 集合,我想要一个可以列出列表元素的子报表,但我不明白如何从内部引用这些元素 iReport 当我在代码中时让它有意义.我可以只从一个领域引用到另一个领域吗?即,一个名为 properties 的字段和直接将该字段引用为 properties.value 的 subresport?

Also, I have List collections of other persistent objects in the ones I'm fetching for the report and I want a subreport that can list the elements of the list, but I don't understand how to reference those from inside iReport to have it make sense when I'm in the code. Can I just refer from one field to another? ie, a field called properties and the subresport referencing that field directly as properties.value?

推荐答案

在使用 JRBeancollectionDataSource 时,我更喜欢这样做:

When using JRBeancollectionDataSource i prefer to do the following:

  1. 确保将项目类路径放在 iReport 的报告导入指令"中
  2. 创建报表查询或子数据集查询时.打开 Report Query 对话框,选择下一个选项卡JavaBean 数据源"并记下 bean 的完整路径名.然后点击读取属性",它应该会读取所有带有 getter 的字段.
  3. 选择您想要的字段并点击添加选定字段.

您将在报告中找到您选择为 $F(fieldName) 的所有内容.

You will find all those you chose as $F(fieldName) in the report.

这篇关于了解 JasperReports 和 JRBeanCollectionDataSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆