Compare current page number with last page number

waited for a long time .. but no reply from Stackoverflow…
Anyway i found my solution..

First in your summary band put this line

<printWhenExpression><![CDATA[new Boolean($P{REPORT_PARAMETERS_MAP}.put("LastPageNumber",$V{PAGE_NUMBER}).equals("dummyPrintWhen"))]]></printWhenExpression>

Remember this above line must be only in the summary band of the report.

After that you can compare this parameter at any point of time in your report to find last page number .

For Example

<printWhenExpression><![CDATA[new Boolean(!$V{PAGE_NUMBER}.equals($P{REPORT_PARAMETERS_MAP}.get("LastPageNumber")))]]></printWhenExpression>

Leave a Comment