actin
actin

Reputation: 43

JasperReport table column sum for page

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?

Upvotes: 1

Views: 4259

Answers (2)

satyamera108
satyamera108

Reputation: 505

enter image description here

In case of Dataset set resetType="Report"

Upvotes: 1

Petter Friberg
Petter Friberg

Reputation: 21710

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

Upvotes: 2

Related Questions