我的表jasper报告多次重复数据

时间:2017-11-23 15:05:21

标签: jasper-reports

这是我的代码

<?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="Etat" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4fe2b837-0ba5-48c3-b3af-dbef44fc0e24">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Participation"/>
    <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="DS_Participation" uuid="ea882ad3-3349-40ed-b1ff-036d84a05d65">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Participation"/>
        <queryString>
            <![CDATA[SELECT "ParticipationFilleS"."nomParticipationFilleS" AS nom,
    "ParticipationFilleS"."id_participationFilleS" AS idp,
    "ParticipationFilleS"."secteurActivite" AS secteurActivite,
    "ParticipationFilleS".date_aquisition AS date_aquisition,
    "ParticipationFilleS"."Prix_acquisition" AS Prix_acquisition,
    "ParticipationFilleS".tri_actualise AS tri_actualise,
    "associationMF"."id_participationfilleS" AS ids,
    "associationMF".pourcentage,
    "associationMF".id_participation AS ID,
    "Participation".id_participation,
    "Participation".nom_participation
FROM "ParticipationFilleS"
     INNER JOIN associationMF ON 
     "associationMF".id_participationfilleS = "ParticipationFilleS"."id_participationfilleS" 
     INNER JOIN Participation ON 
     "Participation".id_participation = "associationMF".id_participation
WHERE 
     "ParticipationFilleS"."id_participationFilleS" = 98]]>
        </queryString>
        <field name="nom" class="java.lang.String"/>
        <field name="secteurActivite" class="java.lang.String"/>
        <field name="date_aquisition" class="java.sql.Timestamp"/>
        <field name="Prix_acquisition" class="java.lang.Double"/>
        <field name="tri_actualise" class="java.lang.Double"/>
        <field name="pourcentage" class="java.lang.Double"/>
        <field name="nom_participation" class="java.lang.String"/>
        <group name="nom">
            <groupExpression><![CDATA[$F{nom}]]></groupExpression>
        </group>
    </subDataset>
    <field name="nom" class="java.lang.String"/>
    <field name="idp" class="java.lang.Integer"/>
    <field name="secteurActivite" class="java.lang.String"/>
    <field name="date_aquisition" class="java.sql.Timestamp"/>
    <field name="Prix_acquisition" class="java.lang.Double"/>
    <field name="tri_actualise" class="java.lang.Double"/>
    <field name="ids" class="java.lang.Integer"/>
    <field name="pourcentage" class="java.lang.Double"/>
    <field name="ID" class="java.lang.Integer"/>
    <field name="id_participation" class="java.lang.Integer"/>
    <field name="nom_participation" class="java.lang.String"/>
    <group name="nom">
        <groupExpression><![CDATA[$F{nom}]]></groupExpression>
    </group>
    <title>
        <band height="152" splitType="Stretch">
            <image>
                <reportElement x="-10" y="78" width="201" height="65" uuid="331a5642-d068-4bed-b795-18334b494880"/>
                <imageExpression><![CDATA["C:/wamp/www/participation/rapports/logo-mamda-mcma1.jpg"]]></imageExpression>
            </image>
            <staticText>
                <reportElement x="380" y="92" width="175" height="21" uuid="9c6b544e-4686-454f-bf0e-144c746eeeee"/>
                <textElement>
                    <font size="16"/>
                </textElement>
                <text><![CDATA[Fonds d'investissement]]></text>
            </staticText>
            <textField>
                <reportElement x="390" y="113" width="175" height="39" uuid="1e8724fc-5e64-4458-a579-28cf32d6dd2f"/>
                <textElement>
                    <font size="18"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{nom}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <detail>
        <band height="183" splitType="Stretch">
            <componentElement>
                <reportElement x="0" y="34" width="555" height="101" uuid="ed5fee48-f9ca-4025-8b6d-c357eb81483a"/>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <datasetRun subDataset="DS_Participation" uuid="a9722c2d-d802-4f86-a305-fdc2e1df98b0">
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="79" uuid="42d1b1c5-d055-4f78-b26a-f8fda409efe3">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="aa702fbd-0f5c-4b17-b0d4-d2e10dc03f14"/>
                                <text><![CDATA[nom]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="0de56ce4-d664-4931-8ece-106e5e768db4"/>
                                <textFieldExpression><![CDATA[$F{nom}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="90a31a3a-df77-43a2-9520-111241cb584b">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="abce9d38-7201-4c2a-a3c4-fee0dda11b41"/>
                                <text><![CDATA[secteurActivite]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="b8f6e00d-b779-4da7-8d3f-26fd82cb5b0b"/>
                                <textFieldExpression><![CDATA[$F{secteurActivite}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="fa42462e-9f80-4501-895c-e3dd6832eb38">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="1f82288b-d999-4f24-a9de-6592706552dc"/>
                                <text><![CDATA[date_aquisition]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="88d0f870-061a-495f-b6ff-a742620f8a0e"/>
                                <textFieldExpression><![CDATA[$F{date_aquisition}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="ebb1be25-78d6-488b-bf5d-53e78bcf23ad">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="d8fa37e9-f47c-4d98-99dc-9a138ebc60b8"/>
                                <text><![CDATA[Prix_acquisition]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="cd844b1a-1c78-4d81-bb4d-5eaab888a2a8"/>
                                <textFieldExpression><![CDATA[$F{Prix_acquisition}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="ab04b310-6350-4581-afea-ccdb59f8550a">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="400b9d08-94a7-4a4e-a3bc-9404fcc97c53"/>
                                <text><![CDATA[tri_actualise]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="f001a429-d66a-415f-9ad2-3e299c109436"/>
                                <textFieldExpression><![CDATA[$F{tri_actualise}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="6239fbc2-7f9c-4e62-8ec8-4c9322d2fa3c">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="ef7aab2a-d28a-4379-9e0b-c006c0b1a428"/>
                                <text><![CDATA[pourcentage]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="35404325-1809-4a28-8b23-014f6d1ae6e8"/>
                                <textFieldExpression><![CDATA[$F{pourcentage}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="79" uuid="fd81313b-0bc8-4cce-9165-1d593e68dbd7">
                        <jr:tableHeader style="Table 1_TH" height="30"/>
                        <jr:tableFooter style="Table 1_TH" height="30"/>
                        <jr:columnHeader style="Table 1_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="79" height="30" uuid="f36f5cf9-540e-48df-b080-6b1e53188b1f"/>
                                <text><![CDATA[nom_participation]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table 1_CH" height="30"/>
                        <jr:detailCell style="Table 1_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="79" height="30" uuid="38267115-36b7-4d21-9564-3bff093ffd22"/>
                                <textFieldExpression><![CDATA[$F{nom_participation}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
            <rectangle>
                <reportElement x="0" y="0" width="556" height="31" backcolor="#9BD2F0" uuid="59d3e0f5-0000-4baf-9ef7-e2f0f4ba4042"/>
            </rectangle>
            <staticText>
                <reportElement x="1" y="0" width="554" height="34" uuid="864f305d-e436-4ab0-9441-e7eb7a30f02f"/>
                <textElement>
                    <font size="18"/>
                </textElement>
                <text><![CDATA[Synthese des cessions realisees en milliers MAD]]></text>
            </staticText>
        </band>
    </detail>
</jasperReport>

如图所示,我只有一张桌子

table created byu jaspersoft

但是当我生成pdf时,它会给我2或3个表格,如图所示 table generated pdf

我不知道发生了什么,为什么它给了我2桌

如何在没有在多列和表中重复相同数据的情况下只获得一个表?

0 个答案:

没有答案