Jump to content

$V{page_number} with group evaluation problem


jacolek

Recommended Posts

Hi,

We recently upgraded to jasperreports 3.6.0 and completed the necessary conversions of older reports. However, one of our reports now displays page_number incorrectly. I've tried to fix this in all possible ways known to man ;) The report simply prints page 1 of X where X should be the total number of pages for the current Group (not the report). This is done in the page footer band and the report currently prints 1 of 1, 2 of 2 etc... the final page for the group being the correct total. Now as this part of the report was not touched for a long time (since before the upgrade).. it seems like the $V{PAGE_NUMBER} variable simplygets the page level evaluation time when placed in the page footer band. The first text box (Page X) has its evaluation time set to page and seems to be working correctly. Second text element has it set to Group with the correct group specified in evaluation group attribute. It still gets the same value as the first however. Now the Group that we're using does have reset page attribute set for obvious reasons.. as we do want the pages in the first (as well as second) text boxes reset when group breaks. could this possibly be a bug in the newer jasperreports API which causes all variables in page footer (tried the header as well) to be evaluated at page time?

thanks a lot for any input.

a sample of how the text elements are defined:

Code:
the group:<group name="ClientGroup" isStartNewPage="true" isResetPageNumber="true">the elements:<textField evaluationTime="Page">    <reportElement x="232" y="100" width="500" height="14"/>    <textElement textAlignment="Right" verticalAlignment="Middle">     <font fontName="SansSerif" size="10" isBold="true" isItalic="false" isPdfEmbedded="false"/>    </textElement>    <textFieldExpression class="java.lang.String"><![CDATA[( "Page  "+$V{PAGE_NUMBER}.intValue() : ""]]></textFieldExpression>   </textField>   <textField evaluationTime="Group" evaluationGroup="ClientGroup">    <reportElement x="734" y="100" width="55" height="14"/>    <textElement verticalAlignment="Middle">     <font fontName="SansSerif" size="10" isBold="true" isItalic="false" isPdfEmbedded="false"/>    </textElement>    <textFieldExpression class="java.lang.String"><![CDATA[("  of  "+$V{PAGE_NUMBER}.toString() : ""]]></textFieldExpression>   </textField>
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

Use the below variable for page count in your printout.

$V{PAGE_NUMBER}

You should use this variable in two text fields as below mentioned

Page $V{PAGE_NUMBER} of $V{PAGE_NUMBER}

Set EvaluationTime property as "NOW" for the first text box field.

Set EvaluationTime propert as "Group" for the second text box field along with the groupname in the EvaulationGroup property.

You can achieve if you could try above.

 

Merci,

Ganapathisundaram.

 

 

 

 

Link to comment
Share on other sites

thanks, but with all due respect, my post maybe a little too descriptive, but

it says that that is exactly what the report has ie sets the PAGE_NUMBER text box to Now and the second one

to group... this has worked flawlessly until we switched to jasper 3.6.1...

that is the reason for my post as it doesn't work now, both show the same page number.. ie they show the value evaluated

at Now or Page time.

 

thanks anyone who can shed some light on this

Link to comment
Share on other sites

  • 1 year later...

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...