I have below similar report in Jaspersoft iReport Designer, but not able to figure out how to sum all values present in vertical column "Doctor Payment" to get a total of "1601"? Length of this columns is variable (i.e. no of rows vary according to size of database & its update frequency ).
Is there any variable like $V{COLUMN_COUNT}
(actually gives no of rows, here 5),
which gives sum of all values in a column? If no, how to do sum?
Doctor ID Doctor Payment
A1 123
B1 223
C2 234
D3 678
D1 343
Total 1601
Best Answer
It is quite easy to solve your task. You should create and use a new variable for summing values of the "Doctor Payment" column.
In your case the variable can be declared like this:
The working example.
CSV datasource:
The template:
The result will be:
You can find a lot of info in the JasperReports Ultimate Guide.