I would like to start page numbering from one on the second page of the report.
I tried to declare a variable with expression ${PAGE_NUMBER} - 1. I used this variable in the page number elements (evaluated now and report time) on the page footer of the report.
This works for most bands of the report. However, on the summary band the value of the declared variable repeats the values from the last content band (that is, values on the title band in my example below).
Is this a correct approach to start the page numbering later?
Mikko
---
My jrxml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.2.final using JasperReports Library version 6.2.2 -->
<!-- 2016-10-18T11:39:50 -->
<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="pageNumberWithVariable" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isTitleNewPage="true" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" uuid="fefee2ed-3ad8-4346-b2dd-96b5020e99bd">
<queryString>
<![CDATA[]]>
</queryString>
<variable name="DOCUMENT_PAGE_NUMBER" class="java.lang.Integer" resetType="None">
<variableExpression><![CDATA[$V{PAGE_NUMBER} - 1]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="227" y="24" width="100" height="30" uuid="3ebe11eb-a4c3-487a-993d-e8850c80344c"/>
<text><![CDATA[Title band]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="60" splitType="Stretch">
<textField>
<reportElement x="100" y="0" width="200" height="30" uuid="d403623a-a2cc-42cb-ac71-0af4687a4dba"/>
<textFieldExpression><![CDATA["DOCUMENT_PAGE_NUMBER: " + $V{DOCUMENT_PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="300" y="0" width="200" height="30" uuid="d403623a-a2cc-42cb-ac71-0af4687a4dba"/>
<textFieldExpression><![CDATA["DOCUMENT_PAGE_NUMBER (Report): " + $V{DOCUMENT_PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="100" y="30" width="200" height="30" uuid="1de2c765-ab79-4bc2-9780-9a4661f3d490"/>
<textFieldExpression><![CDATA["PAGE_NUMBER: " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="300" y="30" width="200" height="30" uuid="449cd2d0-dfd9-4cb9-b01c-9c0c755b1421"/>
<textFieldExpression><![CDATA["PAGE_NUMBER (Report): " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="51" splitType="Stretch">
<staticText>
<reportElement x="227" y="10" width="100" height="30" uuid="c363af6a-b58d-4d03-99c3-ad7c5047a712"/>
<text><![CDATA[Summary band]]></text>
</staticText>
</band>
</summary>
</jasperReport>
---
Image capture of the last page (created using Studio):
0 Answers:
No answers yet