I have several similar reports in my application, for this reason I have created a basic structure with a subreport inside the Title and another one inside the Page Footer.
The problem is that I have 70 similar reports and if one day I need to change the footer structure I don´t wanna have to change 70 reports I prefer change only one.
In the footer subreport I have this:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportFooterV" pageWidth="550" pageHeight="650" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="550" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6a63a92f-0859-4b0b-84b8-6166c2fe0951">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="19"/>
<property name="ireport.y" value="0"/>
<parameter name="date" class="java.lang.String" isForPrompting="false"/>
<title>
<band height="19">
<textField>
<reportElement uuid="89a04d3d-73e0-4f28-9747-3206c4022769" x="0" y="0" width="191" height="19" forecolor="#999999"/>
<textElement verticalAlignment="Bottom">
<font fontName="Roboto" size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto">
<reportElement uuid="89a04d3d-73e0-4f28-9747-3206c4022769" x="352" y="0" width="99" height="19" forecolor="#999999"/>
<textElement textAlignment="Right" verticalAlignment="Bottom">
<font fontName="Roboto" size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</title>
</jasperReport>
But the variable PAGE_NUMBER, doesnt work and always show 1 in the page.
In the main report I have this in the pageFooter area
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="systemParametersSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="properties.Messages" isIgnorePagination="true" uuid="6a63a92f-0859-4b0b-84b8-6166c2fe0951">
....
<pageFooter>
<band height="22">
<subreport>
<reportElement uuid="ac3cfc74-4e5a-45bc-945a-7ca6c82c4f6a" x="2" y="0" width="150" height="22"/>
<subreportParameter name="date">
<subreportParameterExpression><![CDATA[$P{date}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA[$P{footer}]]></subreportExpression>
</subreport>
</band>
</pageFooter>
</jasperReport>
I dont know why I cant find the workaround for this, if anyone can help me...thank you!