2013-10-21 45 views
1

我是的新手JasperReportsiReportiReport中刪除子報告的第一行

我已經創建了一個主要報告,其中包含查詢以及所有要包含的子報告。沒有任何子報告的查詢。

我向主報告添加了一個子報告,並將其設置爲使用數據源,該數據源是從主報告傳遞的參數。

子報告包含在主報告的詳細信息部分,因爲它是要顯示數據的部分。

當我運行主報告時,它獲取子報告,傳遞並將數據添加到子報告中,但出於某種原因,它會從子報告中的數據集中刪除第一行。所以最後它開始顯示子報告中第二行的數據。當我不包含子報告並將這些字段直接放入主報告的詳細信息中時,它會顯示所有行。

我已經嘗試增加報告詳細信息部分的大小/高度和寬度,但它仍然刪除子報告中的第一行。我不知道下一步該做什麼,看看問題可能出在哪裏。

是否需要爲子報表設置配置才能使其工作?

主要報告的細節部分:

<detail> 
     <band height="27" splitType="Stretch"> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="4171aece-1917-4338-8423-449eecf9dfff" key="textField-2" positionType="Float" mode="Opaque" x="180" y="0" width="88" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding90}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="34e23f8d-2664-47e9-be04-5c1494fbb38a" key="textField-7" positionType="Float" mode="Opaque" x="539" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{On time}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="3f707683-90e2-4c36-bb98-f1d6186687ae" key="textField-5" positionType="Float" mode="Opaque" x="449" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Total outstanding}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="4b54c6d3-f4e7-4f33-b84b-c4fd73ff4365" key="textField-8" positionType="Float" mode="Opaque" x="719" y="0" width="83" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="fb5afad4-e7c3-43a8-a3e6-e4d380bc5a51" key="textField-3" positionType="Float" mode="Opaque" x="269" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding60}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="b4809993-6a3c-42b3-bd14-6a62bac0f489" key="textField-4" positionType="Float" mode="Opaque" x="359" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding30}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="903f019a-f45e-4c6d-a580-5045eb8d4671" key="textField-6" positionType="Float" mode="Opaque" x="629" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Advance payment}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="780255b2-20d0-4e3e-8467-1afc5a234b52" key="textField-2" positionType="Float" mode="Opaque" x="90" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding120}]]></textFieldExpression> 
      </textField> 
      <textField pattern="" isBlankWhenNull="true"> 
       <reportElement uuid="e8b6e711-881b-4fe6-be66-445930aa0655" key="textField-1" positionType="Float" mode="Opaque" x="0" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="1"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Status}]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 

子報告:

<?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="OpsommendeKredietVerslagBedrae" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="eb062df7-cf59-4037-972e-a44f935a83cd"> 
    <queryString> 
     <![CDATA[]]> 
    </queryString> 
    <field name="Outstanding30" class="java.lang.Double"/> 
    <field name="Outstanding60" class="java.lang.Double"/> 
    <field name="Outstanding90" class="java.lang.Double"/> 
    <field name="Outstanding120" class="java.lang.Double"/> 
    <field name="On time" class="java.lang.Double"/> 
    <field name="Advance payment" class="java.lang.Double"/> 
    <field name="Total outstanding" class="java.lang.Double"/> 
    <field name="Status" class="java.lang.String"/> 
    <field name="Scheduled payment30" class="java.lang.Double"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="Scheduled payment60" class="java.lang.Double"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="Scheduled payment90" class="java.lang.Double"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <field name="Scheduled payment120" class="java.lang.Double"> 
     <fieldDescription><![CDATA[]]></fieldDescription> 
    </field> 
    <background> 
     <band splitType="Stretch"/> 
    </background> 
    <detail> 
     <band height="26" splitType="Stretch"> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="903f019a-f45e-4c6d-a580-5045eb8d4671" key="textField-6" positionType="Float" mode="Opaque" x="628" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Advance payment}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="fb5afad4-e7c3-43a8-a3e6-e4d380bc5a51" key="textField-3" positionType="Float" mode="Opaque" x="269" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding60}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="3f707683-90e2-4c36-bb98-f1d6186687ae" key="textField-5" positionType="Float" mode="Opaque" x="448" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Total outstanding}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="4171aece-1917-4338-8423-449eecf9dfff" key="textField-2" positionType="Float" mode="Opaque" x="180" y="0" width="88" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding90}]]></textFieldExpression> 
      </textField> 
      <textField pattern="" isBlankWhenNull="true"> 
       <reportElement uuid="e8b6e711-881b-4fe6-be66-445930aa0655" key="textField-1" positionType="Float" mode="Opaque" x="0" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="1"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Status}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="34e23f8d-2664-47e9-be04-5c1494fbb38a" key="textField-7" positionType="Float" mode="Opaque" x="538" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{On time}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="780255b2-20d0-4e3e-8467-1afc5a234b52" key="textField-2" positionType="Float" mode="Opaque" x="90" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding120}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="b4809993-6a3c-42b3-bd14-6a62bac0f489" key="textField-4" positionType="Float" mode="Opaque" x="359" y="0" width="89" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[$F{Outstanding30}]]></textFieldExpression> 
      </textField> 
      <textField pattern="R #,##0" isBlankWhenNull="true"> 
       <reportElement uuid="4b54c6d3-f4e7-4f33-b84b-c4fd73ff4365" key="textField-8" positionType="Float" mode="Opaque" x="717" y="0" width="90" height="26" forecolor="#000000" backcolor="#FFFFFF"/> 
       <box leftPadding="5" rightPadding="5"> 
        <topPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
        <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> 
        <rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> 
       </box> 
       <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None"> 
        <font fontName="Lucida Sans" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> 
        <paragraph lineSpacing="Single"/> 
       </textElement> 
       <textFieldExpression><![CDATA[]]></textFieldExpression> 
      </textField> 
     </band> 
    </detail> 
</jasperReport> 
+2

後JRXML碼子報表。 – user1791574

+0

我已添加主要報告的詳細信息部分和整個子報告,因爲帖子中的字符數量有限制。 – Rentius2407

+2

@ Rentius2407它可能會對您有所幫助:[爲什麼我的子報告中缺少第一條記錄?](http://community.jaspersoft.com/wiki/why-first-record-missing-my-subreport) –

回答

1

我終於得到了答案。

我需要的是通過$P{REPORT_CONNECTION}到我的子報告,這意味着每個報告可以有自己的查詢。主要和所有的子報告

步驟:

  1. 有我的主報表查詢本身
  2. 創建一個子報告,從調色板中拖動。
  3. 關於子報表屬性。設置使用連接表達式
  4. 關於子報告屬性。使用$P{REPORT_CONNECTION}
  5. 通過主報告打開子報告,即右鍵單擊主報告上的子報告標記並單擊打開的子報告。出於某種原因,當我這樣做時,它打開了相同的子報告,但它顯示了我單獨打開時所做的更改。我認爲這是變化發生的地方,因爲在我對這樣開放的那個進行了修改之後,所有這些都發揮了100%的作用。

感謝您的建議

0

闡述一下話題,我曾與一個JavaBeanCollectionDataSource同樣的問題。我有一份主報告,其中包含許多子報表,我希望所有的子報表都用主數據源提供。在所有子報表中使用$P{REPORT_DATA_SOURCE}作爲數據源表達式導致只有第一個子報表被查看(並且由於主報表使用了第一行也缺少第一行)。

解決方案:數據源爲每個子報表的新實例需要

如何:添加填充爲在每個子報表中的數據集的克隆實例。例如:

Map parameters = new HashMap(); 
parameters.put("MasterDataSourceInstance_1", beanColDataSource.cloneDataSource()); 
parameters.put("MasterDataSourceInstance_2", beanColDataSource.cloneDataSource()); 

在報告文件:

<parameter name="MasterDataSource_1" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> 
<parameter name="MasterDataSource_2" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> 

現在,你可以使用(只有一次在每次使用)一個DataSource實例:主報告

<dataSourceExpression><![CDATA[$P{MasterDataSource_1}]]></dataSourceExpression>