I have a main report which contains sub report in footer. I need to hide a text in the sub report on all pages except the first page. I tried to set print when expression using the following expression:
new AbstractSimpleExpression<Boolean> {
@Override
public Boolean evaluate(ReportParameters reportParameters) {
return reportParameters.getPageNumber() == 1;
}
}
But it didn't work. I debugged it and found that reportParameters.getPageNumber() always returns one which I assume to be the page number of sub report. I checked the available methods in reportParameters object and I couldn't found any method to get the page number of main report. Is there any other way to set print when expression for a text in sub report based on the main report's page number?