views:

1976

answers:

4

I am trying to print the last record of the group but the expression "print when group changes: True" does not seem to work. It simply prints all the records of that group. (I've grouped the record based on username).

+1  A: 

I've never used the 'print when group changes' functionality, but trying it now on a new report, I see what you mean - it prints for every detail record even though the group is not changing.

Instead of using the 'print when group changes' flag, uncheck the 'print repeated values' flag, this will probably give you what you want.

Jamie Love
A: 

I'm trying to do the same thing, but I haven't found a way to make the iReport recognizes a group yet.

+2  A: 

I was having trouble with the same issue. Here is the work around that I came up with:

JasperReports has some automatically generated variables that may help you achieve what you want. For every group you create there is a counter that keeps track of the number of items in your current group:

yourGroupName_COUNT

In your printWhenExpression simply add an expression like the following to only print the textfield when your group ruptures:

$V{yourGroupName_COUNT}==1

-Benjamin

A: 

I don't think that attribute is doing what you think it does. It's supposed to be used in conjunction with isPrintRepeatedValues="false" and works the following way:

"if the repeating value you have suppressed spans multiple groups, you can make it reappear at the beginning of a certain report group if you specify the name of that particular group in the printWhenGroupChanges attribute." Ultimate Guide pg. 116

Ilja Preuß