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

wrong PAGE_NUMBER printing in header group


pankaj.sinhasthe

Recommended Posts

Hi,

In the jasper report i need PAGE_NUMBER variable value in group header section for internal use, but it is printing wrong.

I have reproduced issue with a sample report with below source.

In this report there are four section

1. Page Header 

2. Sample Group Group Header  1

3  Sample Group Group Header  2

4. Page Footer

Report prints PAGE_NUMBER value in each section. But in 'Sample Group Group Header 2' group value printing as 2 where as it should be 3.

 

Please find the source below,

The report is tested with Empty datasource in iReport Designer.

<?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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9a56f519-dcb9-4e30-84d0-863ca6492771">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<group name="Sample Group">
<groupHeader>
<band height="133">
<textField>
<reportElement mode="Opaque" x="239" y="22" width="100" height="20" backcolor="#FF00CC" uuid="06b9bc2e-4c19-4a38-bbb1-ed933d276279"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="25" y="22" width="186" height="20" uuid="06119833-79e6-43da-977f-f8270d153b6a"/>
<text><![CDATA[Page No. in Group Header Section 1]]></text>
</staticText>
<break>
<reportElement x="0" y="57" width="100" height="1" uuid="45696df1-7124-48ba-872a-7d78b2798d1e"/>
</break>
</band>
<band height="180">
<textField>
<reportElement mode="Opaque" x="239" y="22" width="100" height="20" backcolor="#00FF00" uuid="8109340c-3382-4847-8542-e255a1ff054f"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="25" y="22" width="186" height="20" uuid="134b847a-61af-4a78-b9d4-755a35821314"/>
<text><![CDATA[Page No. in Group Header Section 2]]></text>
</staticText>
<break>
<reportElement x="0" y="12" width="100" height="1" uuid="b6b64639-189c-42f9-a371-44775e2017da"/>
</break>
</band>
</groupHeader>
</group>
<pageHeader>
<band height="35" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="239" y="2" width="100" height="20" backcolor="#FFFF66" uuid="7881d733-1ac2-4be1-b685-edcdb394df95"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="25" y="2" width="186" height="20" uuid="f9e99160-1255-4dc2-ad5e-489fe78bcf30"/>
<text><![CDATA[Page No. in Header Section]]></text>
</staticText>
</band>
</pageHeader>
<pageFooter>
<band height="54" splitType="Stretch">
<textField>
<reportElement x="399" y="15" width="80" height="20" uuid="59bc437b-e1e6-4a46-9ec0-6ecd35f82a96"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="479" y="15" width="40" height="20" uuid="4ed5e396-6e42-424b-a37d-839db3ea0748"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
 
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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