Search code examples
jasper-reports

How to sum up group results and show it in the column header


I wonder how to sum up group results and show it in the column header.

Example group1 results:

Record 1: Debby
Record 2: Michael

Then in the column header I want to show: Debby, Michael.

I have created a variable 'names':

 Value class name: java.lang.String
 Expression: $F{name}
 Increment type: Group1
 Reset type: page

The column header contains a text field which holds $V{names}.

The result is: Debby

It only shows the first result (I miss Michael).

Does anybody have an idea how to sum up group results and show it in the column header?

Thanks in advance.


Solution

  • Found the answer in array's:

    java.util.ArrayList
    inital value expression: new ArrayList()
    Expression: $V{names}.add($F{name})