-2

我已经根据性别创建了一份统计报告。字段名称Jantina

删除打印重复值时出现问题。我只是希望该字段不会根据Jantina字段重复。但不幸的是,如果没有跟随Jantina,该行不会重复所有行。

怎么做?有人知道吗?

这是我的 jrxml 代码:

<?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="penyata_bulanan_ikut_negeri_jantina_test" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <parameter name="bulan" class="java.lang.Integer">
        <defaultValueExpression><![CDATA[new Integer(-1)]]></defaultValueExpression>
    </parameter>
    <parameter name="tahun" class="java.lang.Integer">
        <defaultValueExpression><![CDATA[new Integer(-1)]]></defaultValueExpression>
    </parameter>
    <parameter name="negeri" class="java.lang.Integer">
        <defaultValueExpression><![CDATA[new Integer(00)]]></defaultValueExpression>
    </parameter>
    <parameter name="jantina" class="java.lang.Long">
        <defaultValueExpression><![CDATA[new Long(2)]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[SELECT @row := @row + 1 as r,bulan,tahun,negeri,jantina,
bilmale,jds,jumall,
ROUND(CAST((bilmale*100 /(jumall))AS DECIMAL(7,3)),2) as percent,
ROUND(CAST((jds*100 /(jumall))AS DECIMAL(7,3)),2) as p_jdk,
countstate
FROM some_table
group by date_format(X.createDate,'%Y' ),date_format(X.createDate,'%M' ),X.male,X.state
order by 1 asc) as a,(select @row := 0) as r]]>
    </queryString>
    <field name="r" class="java.lang.Long"/>
    <field name="bulan" class="java.lang.String"/>
    <field name="tahun" class="java.lang.String"/>
    <field name="negeri" class="java.lang.String"/>
    <field name="jantina" class="java.lang.String"/>
    <field name="bilmale" class="java.math.BigDecimal"/>
    <field name="jds" class="java.math.BigDecimal"/>
    <field name="jumall" class="java.math.BigDecimal"/>
    <field name="percent" class="java.math.BigDecimal"/>
    <field name="p_jdk" class="java.math.BigDecimal"/>
    <field name="countstate" class="java.lang.Long"/>
    <sortField name="bulan"/>
    <sortField name="tahun"/>
    <sortField name="negeri"/>
    <sortField name="jantina"/>
    <group name="bulan">
        <groupExpression><![CDATA[$F{bulan}]]></groupExpression>
        <groupHeader>
            <band/>
        </groupHeader>
        <groupFooter>
            <band/>
        </groupFooter>
    </group>
    <group name="jantina">
        <groupExpression><![CDATA[$F{jantina}]]></groupExpression>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="48" splitType="Stretch">
            <staticText>
                <reportElement x="237" y="10" width="100" height="20"/>
                <textElement>
                    <font fontName="Arial" size="12"/>
                </textElement>
                <text><![CDATA[Penyata bulanan]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="20" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[negeri]]></text>
            </staticText>
            <staticText>
                <reportElement x="79" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[jantina]]></text>
            </staticText>
            <staticText>
                <reportElement x="158" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[bilmale]]></text>
            </staticText>
            <staticText>
                <reportElement x="237" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[jds]]></text>
            </staticText>
            <staticText>
                <reportElement x="316" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[percent]]></text>
            </staticText>
            <staticText>
                <reportElement x="395" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[p_jdk]]></text>
            </staticText>
            <staticText>
                <reportElement x="474" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <text><![CDATA[countstate]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{negeri}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="79" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{jantina}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="158" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{bilmale}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="237" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{jds}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement isPrintRepeatedValues="false" x="316" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{percent}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement isPrintRepeatedValues="false" x="395" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{p_jdk}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement isPrintRepeatedValues="false" x="474" y="0" width="79" height="20"/>
                <textElement textAlignment="Center">
                    <font fontName="Arial"/>
                </textElement>
                <textFieldExpression class="java.lang.Long"><![CDATA[$F{countstate}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>
4

1 回答 1

0

答案是我创建组并将这个公式放在“当表达式时打印”的字段中。那是 new Boolean($V{negeri_COUNT}.intValue()==1) 并且我取消选中“打印重复值”

于 2013-01-14T02:52:06.440 回答