Jump to content
JasperReports Library 7.0 is now available ×

pageHeader and printWhenExpression


mathewrond

Recommended Posts

Hi,

I pass a "isAccountID" variable from Java programme to Jasper reports during the fill time. This is a Boolean parameter.

 

 

If the parameter is "true" then I need to display <pageHeader> only for the first page.

 

 

But here is the actual problem. I have a subreport in <title> band and I cannot figure out how many pages this subreport takes. So the below code would never work for me

 

Code:
<printWhenExpression>
<![CDATA[boolean($V{PAGE_NUMBER}.intValue()==1)]]>
</printWhenExpression>

 

 

How do I solve my problem? Is there a way to get total number of pages that subreport has taken so that I can add +1 to the returnValue and check the printWhenCondition. But again will this work?

 

Thank you for your help.

 

Mathew

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You can return the number of pages from the subreport:

Code:

<variable name="subreportPages" class="java.lang.Integer" calculation="System"/>
..
<subreport>
..
<returnValue subreportVariable="PAGE_NUMBER" toVariable="toVariable"/>

 

You can also take other approaches, e.g. create a dummy group and use its header instead of the page header if you only want it on the first page..

 

HTH,

Lucian

Link to comment
Share on other sites

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