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

print when for the last page with detail records


mariuss

Recommended Posts

Hello community,

I try to hide a field in the column footer on the last page with detail records. I thought if I create an integer variable PageCount_SUM with sum calculation and as expression $V{PAGE_COUNT}, then it will be possible to use the print when expression: $V{REPORT_COUNT}!=$V{PageCount_SUM}. But this does not work.

After previewing the report I know that the report has 14 records on the first page, +17(31) on the second, + 17(48) on the third and +2(50) on the fourth page.

If the print when expression is hard coded like $V{REPORT_COUNT}!=50 or $V{PageCount_SUM}!=50 I will have what I want, but not when I use $V{REPORT_COUNT}!=$V{PageCount_SUM}.

Does anybody have experience with this issue and want to give me a hint how to do it? Or maybe you know another way to do that? Thank you :)

Here is the report using  Jaspersoft Studio 5.5, the Sample DB and groovy, just paste and copy to test it. I need Help :)

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version last--><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="PrintWhenLastDetailPage" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5ed3c130-043e-4bcb-bb9b-599e9d76ab00">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>    <queryString language="SQL">        <![CDATA[select firstname, lastname, street, cityfrom address]]>    </queryString>    <field name="FIRSTNAME" class="java.lang.String"/>    <field name="LASTNAME" class="java.lang.String"/>    <field name="STREET" class="java.lang.String"/>    <field name="CITY" class="java.lang.String"/>    <variable name="RecordPos_COUNT" class="java.lang.Integer" calculation="Count">        <variableExpression><![CDATA[boolean.TRUE]]></variableExpression>    </variable>    <variable name="PageCount_SUM" class="java.lang.Integer" incrementType="Page" calculation="Sum">        <variableExpression><![CDATA[$V{PAGE_COUNT}]]></variableExpression>        <initialValueExpression><![CDATA[0]]></initialValueExpression>    </variable>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch"/>    </title>    <pageHeader>        <band height="35" splitType="Stretch"/>    </pageHeader>    <columnHeader>        <band height="61" splitType="Stretch">            <staticText>                <reportElement x="40" y="2" width="101" height="30" uuid="726ded3a-dee6-4172-8a9b-2e48416794a5"/>                <text><![CDATA[FIRSTNAME]]></text>            </staticText>            <staticText>                <reportElement x="141" y="2" width="138" height="30" uuid="e1e4d9da-aab5-447c-89b5-dd5c34c09997"/>                <text><![CDATA[LASTNAME]]></text>            </staticText>            <staticText>                <reportElement x="279" y="2" width="138" height="30" uuid="18decfc1-65ed-49d9-93a1-0770c2674bda"/>                <text><![CDATA[sTREET]]></text>            </staticText>            <staticText>                <reportElement x="417" y="2" width="138" height="30" uuid="717a4c67-c255-4448-9945-e62d4e0a18ae"/>                <text><![CDATA[CITY]]></text>            </staticText>            <staticText>                <reportElement x="0" y="0" width="40" height="30" uuid="544db95f-2469-456e-9250-e7a4bea75b2b"/>                <text><![CDATA[POS]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="35" splitType="Stretch">            <textField>                <reportElement x="40" y="0" width="101" height="30" uuid="c845a013-6f55-44b1-bb49-5db46c442fb5"/>                <textFieldExpression><![CDATA[$F{FIRSTNAME}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="141" y="0" width="138" height="30" uuid="e8ae0655-0b2c-4bb5-a3c1-f2357c526e16"/>                <textFieldExpression><![CDATA[$F{LASTNAME}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="279" y="0" width="138" height="30" uuid="02677fe9-123e-48f9-b34c-8c7cf0f23a02"/>                <textFieldExpression><![CDATA[$F{STREET}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="416" y="0" width="138" height="30" uuid="aacaee2a-8c76-4c1c-b153-2cb0a6e94334"/>                <textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>            </textField>            <textField>                <reportElement x="0" y="0" width="40" height="30" uuid="ed6c6a13-b25b-46c2-b017-7c66663d4b4a"/>                <textFieldExpression><![CDATA[$V{RecordPos_COUNT}+"."]]></textFieldExpression>            </textField>        </band>    </detail>    <columnFooter>        <band height="52" splitType="Stretch">            <staticText>                <reportElement mode="Opaque" x="0" y="0" width="220" height="20" forecolor="#000000" backcolor="#FFFF00" uuid="4b088258-01cc-42cb-9d90-213783076f61">                    <printWhenExpression><![CDATA[$V{REPORT_COUNT}!=$V{PageCount_SUM}]]></printWhenExpression>                </reportElement>                <text><![CDATA[Please hide me just on the last page with records]]></text>            </staticText>        </band>    </columnFooter>    <pageFooter>        <band height="54" splitType="Stretch"/>    </pageFooter>    <summary>        <band height="46" splitType="Stretch">            <textField isStretchWithOverflow="true">                <reportElement x="0" y="0" width="141" height="30" uuid="9fb1b703-dbd7-4f5b-87c5-e824a90b0da4"/>                <textFieldExpression><![CDATA["Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. nn Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham."]]></textFieldExpression>            </textField>        </band>    </summary></jasperReport>[/code]

Marius

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