Jump to content
Changes to the Jaspersoft community edition download ×

pageHeader and printWhenExpression


Recommended Posts


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





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.



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:


<variable name="subreportPages" class="java.lang.Integer" calculation="System"/>
<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..




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