jasper报告分组 - 不想重置页面

时间:2016-02-27 13:25:28

标签: jasper-reports

我使用逐个城市来计算来自城市的金额并在每行打印

创建新页面并在更改城市时重置页码,这不是必需的。

我没有提供任何这些isStartNewPage =“true”isResetPageNumber =“true”

你能帮我解决这个问题,下面是我正在使用的JRXML:

    <?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1  -->
<!-- 2016-02-28T08:45:17 -->
<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="Sample" pageWidth="960" pageHeight="894" columnWidth="960" leftMargin="0" rightMargin="0" topMargin="30" bottomMargin="30" uuid="c90be235-8362-48ce-8745-330a4fd0ea12">
    <field name="CUSTOMER_NUMBER" class="java.lang.String"/>
    <field name="NAME" class="java.lang.String"/>
    <field name="YTD_SALES" class="java.math.BigDecimal"/>
    <field name="CITY" class="java.lang.String"/>
    <field name="ADDRESS_1" class="java.lang.String"/>
    <field name="ADDRESS_2" class="java.lang.String"/>
    <field name="ZIP" class="java.lang.String"/>
    <field name="STATE" class="java.lang.String"/>
    <variable name="STATE_YTD" class="java.lang.Double" resetType="Group" resetGroup="Group1" calculation="Sum">
        <variableExpression><![CDATA[$F{YTD_SALES}]]></variableExpression>
        <initialValueExpression><![CDATA[0.00]]></initialValueExpression>
    </variable>
    <variable name="OH_CITY_YTD" class="java.lang.Double" resetType="Group" resetGroup="Group2" calculation="Sum">
        <variableExpression><![CDATA[$F{YTD_SALES}]]></variableExpression>
        <initialValueExpression><![CDATA[0.00]]></initialValueExpression>
    </variable>
    <group name="Group2" keepTogether="true">
        <groupExpression><![CDATA[$F{CITY}]]></groupExpression>
    </group>
    <group name="Group1" isResetPageNumber="true" keepTogether="true">
        <groupExpression><![CDATA[$F{STATE}]]></groupExpression>
        <groupFooter>
            <band height="32">
                <staticText>
                    <reportElement x="0" y="0" width="94" height="16" uuid="bd6bfb15-00e9-4186-87e3-ead6e6919370">
                        <property name="local_mesure_unitwidth" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    </reportElement>
                    <text><![CDATA[.]]></text>
                </staticText>
                <staticText>
                    <reportElement x="115" y="16" width="94" height="16" uuid="35091209-9f04-4545-9d44-455cd6bb9b63">
                        <property name="local_mesure_unitwidth" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    </reportElement>
                    <text><![CDATA[TOT YTD SALES]]></text>
                </staticText>
                <textField pattern="##,###,###,###.00 ;##,###,###,###.00-" isBlankWhenNull="true">
                    <reportElement x="216" y="16" width="130" height="16" uuid="fad0c099-068c-458e-b854-9f77fc75148b">
                        <property name="local_mesure_unitwidth" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.width" value="px"/>
                        <property name="local_mesure_unitx" value="pixel"/>
                        <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    </reportElement>
                    <textFieldExpression><![CDATA[$V{STATE_YTD}]]></textFieldExpression>
                </textField>
            </band>
        </groupFooter>
    </group>
    <pageHeader>
        <band height="64" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="8" height="16" uuid="4ded6cc1-a920-4d21-9d11-b48b4bf165ce">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console" size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[1]]></text>
            </staticText>
            <staticText>
                <reportElement x="8" y="0" width="58" height="16" uuid="35091209-9f04-4545-9d44-455cd6bb9b63">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console" size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[RUN DATE]]></text>
            </staticText>
            <textField pattern="MM/dd/yy  hh:mm:ss">
                <reportElement x="72" y="0" width="130" height="16" uuid="fad0c099-068c-458e-b854-9f77fc75148b">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="785" y="0" width="80" height="16" uuid="f39e4155-d285-43e5-a4d0-687b76a52de7">
                    <property name="local_mesure_unitheight" value="pixel"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console" size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[REPORT PAGE]]></text>
            </staticText>
            <textField>
                <reportElement x="893" y="0" width="22" height="16" uuid="7220d7e8-8cbf-4814-9dac-7f1595f337a3">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement textAlignment="Right">
                    <font fontName="Lucida Console" size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="0" y="16" width="634" height="16" uuid="ae9f123c-c840-42cb-b7d3-a5a4e82e7790"/>
                <textElement textAlignment="Center">
                    <font fontName="Lucida Console" isBold="false"/>
                    <paragraph lineSpacingSize="0.0"/>
                </textElement>
                <text><![CDATA[ PRG. NO. 123                            CUSTOMERS SHIP TO ADDRESSES AND YTD SALES]]></text>
            </staticText>
            <staticText>
                <reportElement x="0" y="32" width="634" height="16" uuid="ae9f123c-c840-42cb-b7d3-a5a4e82e7790"/>
                <textElement textAlignment="Center">
                    <font fontName="Lucida Console" isBold="false"/>
                    <paragraph lineSpacingSize="0.0"/>
                </textElement>
                <text><![CDATA[                                                                                               ]]></text>
            </staticText>
            <textField>
                <reportElement x="476" y="32" width="29" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[String.valueOf("(").concat($F{STATE}).concat(")")]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="0" y="48" width="634" height="16" uuid="ae9f123c-c840-42cb-b7d3-a5a4e82e7790"/>
                <textElement>
                    <font fontName="Lucida Console" isBold="false"/>
                    <paragraph lineSpacingSize="0.0"/>
                </textElement>
                <text><![CDATA[   .                                                                                            ]]></text>
            </staticText>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="48" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="792" height="16" uuid="0c8cb5ef-8a0f-49eb-8f4a-e4ef3d5b8101">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[     CUST NUM        SHIP TO NAME                   ADDRESS 1                   ADDRESS 2                 CITY]]></text>
            </staticText>
            <staticText>
                <reportElement x="0" y="16" width="792" height="16" uuid="0c8cb5ef-8a0f-49eb-8f4a-e4ef3d5b8101">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[     --------        ------------                   ---------                   ---------                 ----]]></text>
            </staticText>
            <staticText>
                <reportElement x="0" y="32" width="792" height="16" uuid="0c8cb5ef-8a0f-49eb-8f4a-e4ef3d5b8101">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[ .                                                                                              ]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="48" splitType="Stretch">
            <textField>
                <reportElement x="36" y="0" width="58" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{CUSTOMER_NUMBER}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="36" y="16" width="101" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[String.valueOf("ZIP ").concat($F{ZIP})]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="144" y="0" width="180" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{NAME}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="144" y="16" width="65" height="16" uuid="0c8cb5ef-8a0f-49eb-8f4a-e4ef3d5b8101">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[YTD SALES]]></text>
            </staticText>
            <textField pattern="##,###,###,###.00 ;##,###,###,###.00-" isBlankWhenNull="true">
                <reportElement x="216" y="16" width="130" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA[$F{YTD_SALES}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="360" y="0" width="180" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{ADDRESS_1}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="554" y="0" width="180" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{ADDRESS_2}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="749" y="0" width="180" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
                <textElement textAlignment="Left"/>
                <textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="0" y="32" width="792" height="16" uuid="0c8cb5ef-8a0f-49eb-8f4a-e4ef3d5b8101">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[   .                                                                                            ]]></text>
            </staticText>
            <staticText>
                <reportElement x="706" y="16" width="36" height="16" uuid="04ad0a74-a51c-4b93-967f-2c9e95d43db2">
                    <printWhenExpression><![CDATA[$F{STATE}.equals("OH")]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Lucida Console"/>
                </textElement>
                <text><![CDATA[TOTAL]]></text>
            </staticText>
            <textField pattern="##,###,###,###.00 ;##,###,###,###.00-" isBlankWhenNull="true">
                <reportElement x="749" y="16" width="123" height="16" uuid="c6c7ce27-82a1-467e-9894-eed6a42fe023">
                    <printWhenExpression><![CDATA[$F{STATE}.equals("OH")]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA[$V{OH_CITY_YTD}]]></textFieldExpression>
            </textField>
            <break>
                <reportElement x="0" y="0" width="100" height="1" uuid="c3bdd376-7d6f-4554-8e57-9f67873f4485">
                    <printWhenExpression><![CDATA[new Boolean($V{COLUMN_COUNT}>15)]]></printWhenExpression>
                </reportElement>
            </break>
        </band>
    </detail>
</jasperReport>

我需要变量OH_CITY_YTD才能重置,如果OH状态的城市有变化,但不需要新的页面标题并重置页码。 以及如何打印空行?

0 个答案:

没有答案