问题
I am working on a jasper report, and I am trying to figure out a way for the report to page break on a variable change. The variable is actually a Field, and I put the value of the field in a variable.
Now, the Jasper Reports website has an example on how to break it by count like this
<groupExpression><![CDATA[new Boolean($V{BreakGroup_COUNT}.intValue()
> 5)]] ></groupExpression>
However, I am not sure of any way to compare the previous or next value and breaking after that.
回答1:
You just want the report to start a new page when $F{MyField} changes value.
In this case simply create a group with 'Group Expression': $F{MyField}
Tick the option 'Start on a new page' for the group. There is no need for a variable.
回答2:
Select the header of the group in the Document Structure window, and then select in the Properties window Start on New Page.
来源:https://stackoverflow.com/questions/12061936/jasper-page-break-on-new-field-variable