JasperReport table column sum for page

别来无恙 提交于 2020-01-16 04:32:08

问题


I need TO add a column sum to column footer of table object for each page.

If I create variable and set sum aggregation function than sum value appear for full report. But I need sum column data for each page, not for full report.

Can anyone help me solve this problem?


回答1:


This is not a solution for the jr:table component since it uses a subdataset where its not allowed to set resetType="Page", but using a subreport it can be used.

I don't think there is a work around in components (jr:table,jr:list) using a subdataset but would be happy If someone can prove me wrong

Solution using subreport

On your variable set resetType="Page"

es.

<variable name="var" class="java.lang.Double" resetType="Page" calculation="Sum"/>
....
</variable>

For more info on resetType see JRVariable API

On your textField set evaluationTime="Page"

es.

<textField evaluationTime="Page">
 ....
</textField>

For more info on evaluationTime see JRTextField API




回答2:


In case of Dataset set resetType="Report"



来源:https://stackoverflow.com/questions/34072511/jasperreport-table-column-sum-for-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!