Page number is not displaying on all pages in the report. Report contains subreports.

ISSUE:  Page number is not displaying on all pages in the report.  Report contains three subreports.  Specifically, the preview displays Page 33 of 38 or Page 24 of 25. 

               I expected the report to display 1 of 38, 2 of 38, 3 of 38, 4 of 38, 5 of 38, so on.

Within the "Page Footer" section of the Report Inspector, I create this text field.

"Page " +$V{currentPage}+" of " + $V{PAGE_NUMBER}

Expression Class is java.lang.String

Evaluation time is Auto

Note:  I created variable $V{currentPage} with class = java.lang.Integer, Calculation = Nothing, Reset Type = Page, Variable Expression = $V{PAGE_NUMBER}, and all other properties are default values.

 

What am I doing wrong?  What specific steps should I perform to have page numbers display on every page instead of the last few pages.  Thanks.

 

cleveland.o.burnett1's picture
Joined: Aug 18 2022 - 10:28am
Last seen: 3 weeks 5 days ago

I failed to mention that I am working with Jaspersoft iReport Designer 5.6.0.  Would the page number solution be different for this Jaspersoft iReport version?  Thanks again for any direction.

cleveland.o.burnett1 - 1 month 3 weeks ago

3 Answers:

  1. Page number element not placed on all bands: Ensure that the page number element is placed on the correct band (e.g., page header, page footer) and that it is present on all sub-reports as well.

  2. Please click on Summery with page header and footer

mahadiosb's picture
526
Joined: Jan 24 2020 - 6:53am
Last seen: 2 weeks 6 days ago

The issue is that $V{PAGE_NUMBER} does not account for sub-reports.  You will need to update the page number expression and use the $V{MASTER_CURRENT_PAGE} and $V{MASTER_TOTAL_PAGES} built-in variables.  Also, set the evaluation time on that expression to Master.

<textField evaluationTime="Master" isBlankWhenNull="true">
    <reportElement x="760" y="12" width="150" height="13" forecolor="#000000" backcolor="#FFFFFF" uuid="02a85f92-befb-40fc-b214-9099b4d17de8">
        <property name="com.jaspersoft.studio.unit.width" value="px"/>
        <property name="com.jaspersoft.studio.unit.height" value="px"/>
    </reportElement>
    <textElement textAlignment="Right">
        <font fontName="Arial" size="8"/>
    </textElement>
    <textFieldExpression><![CDATA["Page " + TEXT($V{MASTER_CURRENT_PAGE}, "#,###") + " of " + TEXT($V{MASTER_TOTAL_PAGES}, "####")]]></textFieldExpression>
</textField>

jgust's picture
4916
Joined: Jun 10 2010 - 6:39am
Last seen: 3 days 55 min ago
cleveland.o.burnett1's picture
Joined: Aug 18 2022 - 10:28am
Last seen: 3 weeks 5 days ago
Feedback
randomness