Jump to content
Changes to the Jaspersoft community edition download ×

PAGE_NUMBER issue, Please help!


2004 IR Help

Recommended Posts

By: twr2 - twr2

PAGE_NUMBER issue, Please help!

2005-02-07 15:29

This question is related to the page n of m problem, but is a little different.

 

I have a main datasource that has:

 

<pageFooter>

<band height="12">

 

 

<textField evaluationTime="Now">

<reportElement x="200" y="1" width="40" height="11"/>

<textElement textAlignment="Center" lineSpacing="Single" verticalAlignment="Bottom">

<font reportFont="Font_Small" />

</textElement>

<textFieldExpression class="java.lang.String">

"Page "+(($V{PAGE_NUMBER}).toString())+" of "

</textFieldExpression>

</textField>

<textField evaluationTime="Report">

<reportElement x="238" y="1" width="20" height="11"/>

<textElement textAlignment="Center" lineSpacing="Single" verticalAlignment="Bottom">

<font reportFont="Font_Small" />

</textElement>

<textFieldExpression class="java.lang.String">

($V{PAGE_NUMBER}).toString()

</textFieldExpression>

</textField>

</band>

</pageFooter>

 

This main datasource has several subreports (on the very first I use isResetPageNumber="true") that it runs several times. Each iteration through the subreports (a "employee report"), the current page number an total page number should reset. So if there are two "employee reports" within the same Jasper report and each with 10 pages, the page numbering should be n of 10 for both reports. This is precisely what happens IF both "employee reports" have the same number of pages.

 

So, the problem is, the total number of pages (the 'm' in "n of m") is using the value for the last "employee report" for all the "employee reports". So if the 1st "employee report" is 5 pages and the second has 10 pages, both "employee reports" will use "n of 10" when one should use "n of 5" for the first one and "n of 10" for the second.

 

What I think would fix the issue is if there exisited something like evaluationTime="CompletedEmployeeReport" instead of evaluationTime="Report"; so that the second textfield with PAGE_NUMBER is not evaluating at the end of the Jasper report, but at the end of the "employee report".

 

Any ideas would be most welcome.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...