Jump to content
Changes to the Jaspersoft community edition download ×

Page number reset based on grouping.


crazyzai0123
Go to solution Solved by crazyzai0123,

Recommended Posts

Hi , im new to jasper report , i wish to know is it possible that :

Group 1 having 3 page
group 1 having 1 page

I want to display:

Group 1 : Page 1 of 3, Page 2 of 3, Page 3 of 3

Group 2 : Page 1of 1.

Possible to do this with jasper report ? 

Source:

<queryString language="SQL">    <![CDATA[select * from Persons where ID = $P{ID}]]></queryString><field name="ID" class="java.lang.Object"/><group name="myGroup" isStartNewPage="true" isResetPageNumber="true">    <groupHeader>        <band height="224">            <subreport>                <reportElement x="300" y="135" width="270" height="60" uuid="1f20858d-c055-41e2-9a60-bbc040ae6485"/>                <subreportParameter name="ID_PERSON">                    <subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>                </subreportParameter>                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>                <subreportExpression><![CDATA["subreport_1.jasper"]]></subreportExpression>            </subreport>            <staticText>                <reportElement x="280" y="10" width="100" height="30" uuid="dacdfcd9-150b-419d-ba3b-b56949cd518d"/>                <text><![CDATA[Group 1]]></text>            </staticText>            <break>                <reportElement x="0" y="210" width="99" height="1" uuid="a77bf8e0-98ea-4167-b852-f2cb5f6e1cf6"/>            </break>            <staticText>                <reportElement x="280" y="58" width="300" height="30" uuid="df9536c9-6584-43b3-b8b9-45fd0c0b95a6"/>                <text><![CDATA[This report is to testing the grouping.]]></text>            </staticText>            <break>                <reportElement x="0" y="111" width="100" height="1" uuid="6cda26ee-6e49-4e94-8d58-5d5dd42745e6"/>            </break>        </band>    </groupHeader>    <groupFooter>        <band height="50"/>    </groupFooter></group><group name="myGroup2" isStartNewPage="true" isResetPageNumber="true">    <groupHeader>        <band height="130">            <subreport>                <reportElement x="270" y="60" width="300" height="60" uuid="5663a0dc-9b14-485b-84a9-21b5e0c3b98d"/>                <subreportParameter name="ID_PERSON">                    <subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>                </subreportParameter>                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>                <subreportExpression><![CDATA["subreport_2.jasper"]]></subreportExpression>            </subreport>            <staticText>                <reportElement x="280" y="20" width="100" height="30" uuid="eaa5ee0f-c0e5-4555-b321-a4db52b4efde"/>                <text><![CDATA[Group 2]]></text>            </staticText>        </band>    </groupHeader>    <groupFooter>        <band height="58"/>    </groupFooter></group><pageFooter>    <band height="57" splitType="Stretch">        <textField evaluationTime="Group" evaluationGroup="myGroup">            <reportElement x="400" y="10" width="100" height="30" uuid="215676d9-e972-45bd-adad-b79c1fa27112"/>            <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>        </textField>        <textField>            <reportElement x="310" y="10" width="110" height="30" uuid="75a82ec2-a8ed-46dd-b5a1-147c450e32f8"/>            <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>        </textField>    </band></pageFooter>

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...

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