JasperReport table column sum for page

2019-08-14 05:21发布

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条回答
我只想做你的唯一
2楼-- · 2019-08-14 05:39

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

查看更多
登录 后发表回答