Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When adding more rows in table in jaspersoft subreport in print the first page success and other is empty, why?

I have a main report this main report contains two subreports ,

The first subreport contains two tables, when there is a lot of data on the first table it prints the first page successfully but the other pages are empty.

The expected output is to continue show the rows of the first table until it go to the second table, if there is no a lot of data it works correctly

This the design code :

<band height="429">
        <staticText>
            <reportElement x="13" y="5" width="100" height="60" uuid="b236e2f4-495e-4a22-87fa-4e316ea5f41f"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font size="11" isBold="true"/>
            </textElement>
            <text><![CDATA[Account Number :]]></text>
        </staticText>
        <staticText>
            <reportElement x="13" y="27" width="89" height="18" uuid="7fdc8df6-4c51-4d87-b8f7-cb0acec8acef"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font size="11" isBold="true"/>
            </textElement>
            <text><![CDATA[Description :]]></text>
        </staticText>
        <staticText>
            <reportElement x="13" y="47" width="80" height="21" uuid="294925d2-bf2a-4c51-9f8a-339873e0f747"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font size="11" isBold="true"/>
            </textElement>
            <text><![CDATA[Period from :]]></text>
        </staticText>
        <textField>
            <reportElement x="113" y="7" width="100" height="17" uuid="0406491b-1bdb-41db-8ece-4058578dc28a"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{CUSTOMERACCOUNTNUMBER}]]></textFieldExpression>
        </textField>
        <textField>
            <reportElement x="100" y="24" width="350" height="23" uuid="f3a441fe-3d57-490d-9d24-cd0d060694f3"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <textFieldExpression><![CDATA["Summary invoice for "+ $F{COMPANYNAME}]]></textFieldExpression>
        </textField>
        <textField>
            <reportElement x="204" y="47" width="100" height="20" uuid="e71997f3-50fb-4736-8fdc-cd74d95204db"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{PERIODTO}]]></textFieldExpression>
        </textField>
        <staticText>
            <reportElement x="174" y="47" width="30" height="20" uuid="bec9327c-65d8-4070-9b55-ddeaa6527e2f"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <text><![CDATA[  To:]]></text>
        </staticText>
        <textField>
            <reportElement x="94" y="47" width="80" height="20" uuid="9e431304-75d4-43e6-9e7b-663a1dabf504"/>
            <textElement textAlignment="Left" verticalAlignment="Middle">
                <font isBold="true"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{PERIODFROM}]]></textFieldExpression>
        </textField>
        <frame>
            <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="20" y="-10" width="760" height="287" isPrintWhenDetailOverflows="true" uuid="81f11b41-36e2-4795-9965-02ae41b1b338"/>
            <box>
                <topPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
                <leftPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
                <bottomPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
                <rightPen lineWidth="2.0" lineStyle="Solid" lineColor="#20E827"/>
            </box>
            <componentElement>
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="21" y="111" width="724" height="60" isPrintWhenDetailOverflows="true" uuid="6b9558ad-488a-4954-98f0-b4a4c19a3dbe">
                    <property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <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="InvoiceDetailDS" uuid="d4a58f73-73e9-432a-bc4c-bc82959e3959">
                        <datasetParameter name="headerId">
                            <datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
                        </datasetParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="95" uuid="52966a24-1f98-4445-b6f6-f83ada4ec1f8">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="868f2a68-0cba-47ce-9c30-f955deb28e85"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Service ID]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="4dce2c60-c99f-4752-9697-492e8e2d9930"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{ORDERSERVICEID}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="92" uuid="bb1703e2-5b7e-4bef-9772-e40ee123a9bd">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="92" height="30" backcolor="#A6FFB5" uuid="56038351-cd7e-4c6d-9158-4d071e26faf8"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Order Number]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField>
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="92" height="30" uuid="f1d27619-7b71-407d-a449-f3bfa1906c93"/>
                                <box>
                                    <topPen lineWidth="0.3"/>
                                    <leftPen lineWidth="0.3"/>
                                    <bottomPen lineWidth="0.3"/>
                                    <rightPen lineWidth="0.3"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{ROSNUMBER}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="95" uuid="2703ba82-935b-496b-a4af-223f33a4a23c">
                        <jr:tableHeader height="1" rowSpan="1"/>
                        <jr:tableFooter height="1" rowSpan="1"/>
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="95" height="30" backcolor="#A6FFB5" uuid="f1fe79d1-2cea-42b1-88cb-1bc4e70ef6e1"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Action Type]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="0" rowSpan="1"/>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="30" isPrintWhenDetailOverflows="true" uuid="d512d971-c04f-4ecf-8a11-22b3fcbdffc0"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{ACTIONTYPE}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="80" uuid="479436d0-de8d-4cd6-9b8d-cc8f42eef53d">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="80" height="30" backcolor="#A6FFB5" uuid="9d46cd49-e847-4967-b69b-daa03cb3ed2f"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Invoice From]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="80" height="30" uuid="9b755792-0ce6-4144-985a-cf2f50e97c4b"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{INVOICEFROM}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="71" uuid="3b39699e-eeda-408c-a2af-d45125fe57ed">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="71" height="30" backcolor="#A6FFB5" uuid="5426229a-2a89-4335-aa9f-b42b51707041"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Invoice To]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="71" height="30" uuid="38071396-7786-4aec-ae98-64780811e474"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{INVOICETO}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="101" uuid="6c5336a5-d796-469d-b843-f1062bf7f7ca">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="101" height="30" backcolor="#A6FFB5" uuid="49d8ab5c-272e-428d-b4c2-466c13d9a2b7"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Non-Recurring Charges]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="101" height="30" uuid="a93bc30f-13bc-4eaf-9cec-92849cc69756"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{NRC}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="99" uuid="f2b13180-33c5-405d-883f-402c53c8cf20">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="99" height="30" backcolor="#A6FFB5" uuid="4cc22936-e12f-4bca-bb22-453d021d61c1"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Recurring Charges]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="99" height="30" uuid="b5639d81-207e-432c-b3e0-793bf7dd533e"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{MRC}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="90" uuid="d2a8e5ef-097b-4e8c-b0bd-84f8f2a272bd">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="90" height="30" backcolor="#A6FFB5" uuid="b2f75a95-5ac4-415b-b64b-05bcf3c77bef"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Amount SAR]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField pattern="#,##0.###;(#,##0.###)" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="30" uuid="0b9a5ef9-9e8a-406f-ab70-95d32ff00a40"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{TOTALAMOUNT}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </frame>
    </band>
</title>
<summary>
    <band height="326">
        <frame>
            <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="130" y="120" width="760" height="206" isPrintWhenDetailOverflows="true" forecolor="#000000" uuid="1c3a92e7-b648-4580-acae-afb17ad5d59e"/>
            <box>
                <topPen lineWidth="2.0" lineColor="#20E827"/>
                <leftPen lineWidth="2.0" lineColor="#20E827"/>
                <bottomPen lineWidth="2.0" lineColor="#20E827"/>
                <rightPen lineWidth="2.0" lineColor="#20E827"/>
            </box>
            <componentElement>
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" mode="Opaque" x="-89" y="-19" width="407" height="60" isPrintWhenDetailOverflows="true" uuid="1866fba3-4869-4d93-af0f-36422d16eccf">
                    <property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <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="InvoiceDetailDS" uuid="4f1d98f2-fe87-477a-90b3-7524f0cab260">
                        <datasetParameter name="headerId">
                            <datasetParameterExpression><![CDATA[$F{HEADERID}]]></datasetParameterExpression>
                        </datasetParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="93" uuid="7c67a26e-a635-4ddb-8406-4a2f9b225c87">
                        <jr:tableHeader height="1" rowSpan="1"/>
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="93" height="30" backcolor="#A6FFB5" uuid="635a9e6c-697a-4637-b674-69aa8c753ed8"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Old SRF Number]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="93" height="30" isPrintWhenDetailOverflows="true" uuid="ef0042fa-17e5-4f0a-b1d1-d091bf1723db"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{OLDSRFNUMBER}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="191" uuid="1410c880-6b1d-44c3-95a3-9bddc86bb688">
                        <jr:tableHeader height="1" rowSpan="1"/>
                        <jr:tableFooter height="1" rowSpan="1"/>
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="191" height="30" backcolor="#A6FFB5" uuid="5001b005-2471-484a-9656-1886d2462ca1"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[Old Service Description]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="0" rowSpan="1"/>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="191" height="30" isPrintWhenDetailOverflows="true" uuid="e51f0035-cad9-4cc8-baef-06d208073ef5"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{OLDSERVICE}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="100" uuid="07118eff-f7e7-4577-a4da-8c58e40ae256">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="100" height="30" backcolor="#A6FFB5" uuid="6d4ed900-1965-402a-adaf-731c484c93ee"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[New SRF Number]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="100" height="30" uuid="14c2da73-ebca-44a5-b6b5-ddaa50f4c360"/>
                                <box>
                                    <topPen lineWidth="0.3"/>
                                    <leftPen lineWidth="0.3"/>
                                    <bottomPen lineWidth="0.3"/>
                                    <rightPen lineWidth="0.3"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle"/>
                                <textFieldExpression><![CDATA[$F{SRFNUMBER}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="332" uuid="587c3be8-0a7a-447e-b522-63b507e03f3e">
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement mode="Opaque" x="0" y="0" width="332" height="30" backcolor="#A6FFB5" uuid="d571175e-3038-47b7-b9b8-a17e3ba7c271"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Center" verticalAlignment="Middle">
                                    <font size="11" isBold="true"/>
                                </textElement>
                                <text><![CDATA[New Service Description]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:detailCell height="30" rowSpan="1">
                            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="332" height="30" isPrintWhenDetailOverflows="true" uuid="a3e861ee-40be-4c0c-bcc6-3fce102aa07c"/>
                                <box>
                                    <topPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <leftPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <bottomPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                    <rightPen lineWidth="0.3" lineStyle="Solid" lineColor="#000000"/>
                                </box>
                                <textElement textAlignment="Left" verticalAlignment="Middle">
                                    <paragraph leftIndent="5"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$F{DESCRIPTION}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </frame>
    </band>

This is how the two subreports are included in the main report:

    <subreport>
            <reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
                <property name="local_mesure_unitwidth" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.width" value="px"/>
            </reportElement>
            <subreportParameter name="INVOICE_NO">
                <subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
        </subreport>
        <subreport>
            <reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
            <subreportParameter name="INVOICE_NO">
                <subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
            </subreportParameter>
            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
            <subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
        </subreport> 

How can I solve this ?

Edit

After trying to change some pages properties , the fill report give me out of memory exception, after searching i used virtualizer but not solved.

SourceFileName = SourceFileName.replaceAll("//", "/");
                    JRVirtualizer virtualizer = new JRSwapFileVirtualizer(1000, new JRSwapFile(reportsDirString.replaceAll("//", "/"), 2048, 1024), true);

                    JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
                    // .replaceAll("\\\\", "\\\\")
                    parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer);  
like image 677
Yousef Al Kahky Avatar asked Feb 13 '17 09:02

Yousef Al Kahky


People also ask

How do you pass value from subreport to main report in iReport?

If you use a subreport insteadCreate a variable totalByStudent in the main report with calculation type set to System . Click on the subreport and in the properties panel click on Return values. Click Add and select: Subreport variable: total, Local Destination Variable: totalByStudent, rest leave to default.

What is subreport in Jasper report?

A subreport is a report included inside another report. This allows the creation of very complex layouts with different portions of a single document filled using different data sources and reports.


2 Answers

As mentioned by @philipobrien above placing a sub-report in the Detail band is usually incorrect unless you intentionally want a new report per row returned by your data source.

I would recommend using the GroupFooter section which allows for multiple bands. These bands are filled in the order in which they are appear in the JRXML.

The following sample shows how you can use the GroupFooter section with two bands. As far as I can remember the GroupFooter bands will auto expand their height so there is no need to specifically set the height unless of course you want a minimum height.

Please note that I have removed the GroupHeader section from the below sample. In this scenario there was no need for this section. Also note the dummy expression used to ensure the group displays.

<group name="DUMMY_GROUP">
    <groupExpression><![CDATA[0 == 0]]></groupExpression>
    <groupFooter>
        <band>
            <subreport>
                <reportElement positionType="Float" x="12" y="647" width="796" height="30" isRemoveLineWhenBlank="true" uuid="01ec6c49-7d39-4bea-836e-69715b24090c">
                    <property name="local_mesure_unitwidth" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <subreportParameter name="INVOICE_NO">
                    <subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["InvoiceServiceDetails.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band>
            <subreport>
                <reportElement positionType="Float" x="11" y="677" width="797" height="28" isRemoveLineWhenBlank="true" uuid="aef8cb38-ed55-4893-aca0-96d852a2f5e7"/>
                <subreportParameter name="INVOICE_NO">
                    <subreportParameterExpression><![CDATA[$P{INVOICE_NO}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["InvoiceServiceSummaryDetails.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </groupFooter>
</group>
like image 195
Garreth Golding Avatar answered Oct 01 '22 21:10

Garreth Golding


Sub-reports should rarely be placed in the Detail band, although there are occasionally valid reasons to do so.

The reason for this is that the sub-reports will be reproduced once for each row of data returned by your main query e.g. if you have 1 row returned you will get 1 copy of each subreport, if you have 100 rows returned you will get 100 of each sub-report. If your sub-reports also have 100 rows each you are returning 10k rows for every sub-report and are very likely to hit an out of memory exception error.

Try moving your sub-reports to either a Header/Footer band or to the Summary band and then run the report.

like image 21
philipobrien Avatar answered Oct 01 '22 21:10

philipobrien