Subreport within a list returns error: data source not found

0

Good afternoon guys,

I have a subreport inside a list, and when I try to print the report, it is returning me this " data source not found " error in the eclipse console. I have already compiled all subreports and they are in the same directory.

By putting the same subreport out of the list, I can print my report normally, but the result is not as expected. Should I put this subport inside a component list, so it can be iterated.

subreport xml:

<frame>
            <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="12" y="20" width="553" height="44" isPrintWhenDetailOverflows="true"/>
            <box>
                <pen lineWidth="0.5"/>
                <topPen lineWidth="0.5"/>
                <leftPen lineWidth="0.5"/>
                <bottomPen lineWidth="0.5"/>
                <rightPen lineWidth="0.5"/>
            </box>
            <componentElement>
                <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="553" height="43" isPrintWhenDetailOverflows="true"/>
                <jr:list 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="Seguro_Set">
                        <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("//seg")]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="43">
                        <textField isBlankWhenNull="true">
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="9" width="137" height="13" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle">
                                <font size="6"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{xSeg_set}]]></textFieldExpression>
                        </textField>
                        <textField isBlankWhenNull="true">
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" x="137" y="9" width="260" height="13" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle">
                                <font size="6"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[($F{respSeg_set}.equals("1")?" Emitente do MDF-e":
($F{respSeg_set}.equals("2")?"Responsável pela contratação do serviço de transporte (contratante)":
     ""))]]></textFieldExpression>
                        </textField>
                        <textField isBlankWhenNull="true">
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" x="397" y="9" width="153" height="13" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
                            <textElement textAlignment="Center" verticalAlignment="Middle">
                                <font size="6"/>
                            </textElement>
                            <textFieldExpression class="java.lang.String"><![CDATA[$F{nApol_set}]]></textFieldExpression>
                        </textField>
                        <staticText>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="137" height="9" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#EAEAEA"/>
                            <box bottomPadding="0">
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
                            </box>
                            <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" lineSpacing="Single">
                                <font fontName="Times New Roman" size="5" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
                            </textElement>
                            <text><![CDATA[NOME DA SEGURADORA]]></text>
                        </staticText>
                        <staticText>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="137" y="0" width="258" height="9" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#EAEAEA"/>
                            <box bottomPadding="0">
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
                            </box>
                            <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" lineSpacing="Single">
                                <font fontName="Times New Roman" size="5" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
                            </textElement>
                            <text><![CDATA[RESPONSÁVEL]]></text>
                        </staticText>
                        <staticText>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="399" y="0" width="153" height="9" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#EAEAEA"/>
                            <box bottomPadding="0">
                                <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                                <bottomPen lineWidth="0.0" lineColor="#000000"/>
                                <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#FFFFFF"/>
                            </box>
                            <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" lineSpacing="Single">
                                <font fontName="Times New Roman" size="5" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
                            </textElement>
                            <text><![CDATA[NÚMERO APÓLICE]]></text>
                        </staticText>
                        <line>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="9" width="553" height="1" isPrintWhenDetailOverflows="true"/>
                            <graphicElement>
                                <pen lineWidth="0.5"/>
                            </graphicElement>
                        </line>
                        <line>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="21" width="553" height="1" isPrintWhenDetailOverflows="true"/>
                            <graphicElement>
                                <pen lineWidth="0.5"/>
                            </graphicElement>
                        </line>
                        <line>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="397" y="1" width="1" height="20" isPrintWhenDetailOverflows="true"/>
                            <graphicElement>
                                <pen lineWidth="0.5"/>
                            </graphicElement>
                        </line>
                        <line>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="136" y="1" width="1" height="20" isPrintWhenDetailOverflows="true"/>
                            <graphicElement>
                                <pen lineWidth="0.5"/>
                            </graphicElement>
                        </line>
                        <line>
                            <reportElement key="" positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="553" height="1" isPrintWhenDetailOverflows="true"/>
                            <graphicElement>
                                <pen lineWidth="0.5"/>
                            </graphicElement>
                        </line>
                        <subreport>
                            <reportElement stretchType="RelativeToTallestObject" x="1" y="22" width="551" height="21" isRemoveLineWhenBlank="true"/>
                            <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/seg/nAver")]]></dataSourceExpression>
                            <subreportExpression class="java.lang.String"><![CDATA[$P{BASEPATH} + "DADOSNUMAVERBACAO3.jasper"]]></subreportExpression>
                        </subreport>
                    </jr:listContents>
                </jr:list>
            </componentElement>
        </frame>

subreport within list:

<queryString language="xPath">
    <![CDATA[/mdfeProc/MDFe/infMDFe/seg/nAver]]>
</queryString>
<field name="nAver" class="java.lang.String">
    <fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
<variable name="nAver" class="java.lang.String" incrementType="Column">
    <variableExpression><![CDATA[($V{nAver} == null ? "" : $V{nAver} + ", ") + $F{nAver}]]></variableExpression>
</variable>
<summary>
    <band height="19">
        <staticText>
            <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="135" height="19"/>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font fontName="Times New Roman" size="5" isBold="true" pdfFontName="Helvetica-Bold"/>
            </textElement>
            <text><![CDATA[NÚMEROS DE AVERBAÇÃO:]]></text>
        </staticText>
        <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
            <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="135" y="0" width="413" height="17" isPrintWhenDetailOverflows="true"/>
            <box topPadding="1" leftPadding="3"/>
            <textElement>
                <font size="6" isBold="false"/>
            </textElement>
            <textFieldExpression class="java.lang.String"><![CDATA[$V{nAver}]]></textFieldExpression>
        </textField>
        <line>
            <reportElement key="" positionType="Float" stretchType="RelativeToBandHeight" mode="Transparent" x="135" y="0" width="1" height="19" isPrintWhenDetailOverflows="true"/>
            <graphicElement>
                <pen lineWidth="0.5"/>
            </graphicElement>
        </line>
    </band>
</summary>
    
asked by anonymous 06.06.2018 / 22:00

0 answers