在JasperReports中打印何时(最后一个元素到达)表达式 [英] Print When (last element reached) Expression in JasperReports

查看:122
本文介绍了在JasperReports中打印何时(最后一个元素到达)表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能生成一个打印时表达式,检测XML数据源文件中的最后一个元素?



基本上我有一个插入列中断的报告在一个详细的带子报告后,我可以清楚地定义新的记录开始的新页面。但总是让我留下最后一页的空白。所以我希望我可以防止这一点,如果我有一个打印条件,防止列中断,如果它是XML数据源中的最后一个记录元素。

这是甚至有可能吗?

解决方案

问题在于,您不知道它是最后一个元素,直到您查找下一个元素。我不认为有一个简单的方法。

原则上应该是这样做的:
创建一个super-报告整个报告。在超级报告中运行相同的查询。计算行数。然后将行数传递给原始报表(现在是一个子报表),然后重新运行该查询。显然,运行查询两次是另一个缺点。

如果数据源是SQL,那么我建议修改SQL以返回作为结果的一部分的行数组。但对于非SQL数据源,在到达最后一行之前,需要知道行数(以及识别最后一行的某种方式)的方法。


Is it possible to generated a "Print When Expression" that detects the last element in an XML datasource file?

Basically I have a report with a column break inserted after a sub-report in a detail band so I can clearly define new pages for the beginning of a new record. But it always leaves me with a blank last page. So I am hoping that I can prevent this if I have a print when condition that prevents the column break if it is the last record element in the XML datasource.

Is this even possible?

解决方案

The problem is that you don't know it's the last element until after you look for the next element. I don't think there is a simple way.

In principle it should be fine to do something like this:
Create a super-report around the entire report. Run the same query in the super-report. Count the rows. Then pass the number of rows to the original report (which is now a subreport) and re-run the query again. Clearly, running the query twice is another drawback.

If the data source were SQL, then I would suggest modifying the SQL to return the number of rows as part of the result set. But for non-SQL data sources, you need some way of knowing the number of rows (well... some way of identifying the last row) before you reach the last row.

这篇关于在JasperReports中打印何时(最后一个元素到达)表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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