Jump to content
We've recently updated our Privacy Statement, available here ×

How to display different content of the footer based on the total number of pages?


henry.cui

Recommended Posts

Hello Jaspersoft Community,

I have the following requirement:
1. If the report has more than 1 page, display the page number on the right, display text "For internal Use Only" on the left.
2. If the report has 1 page, do not display the page number, display text "For internal Use Only" in the middle.


I googled it, and someone suggested the following:
/****************************************************************************************************
 Create a variable like:
      <variable name="totalPages" class="java.lang.Integer" resetType="None" incrementType="Report">
          <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
    </variable>

Based in variable totalPages to hide/show contents on page:

           In some element of page set in property 'Print When Expression' a expression, for example: ($V{totalPages} == 1) || ($V{totalPages} == 2) || ($V{totalPages} % 2 == 0)
*****************************************************************/

This does not work for me. Both pages put the text  "For internal Use Only" in the middle. There is no page number.

Some people suggested this cannot be done because "We cannot use late evaluation in variables".

How to solve my scenario?

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