Search code examples
jasper-reportsireport

First line in sub report being removed in iReport


I'm new to JasperReports and iReport.

I have created a main report which holds the query for itself and all the sub reports I'm going to include. No queries on any sub report.

I'm adding a sub report to the main report and set it to use a data source which is a parameter being passed from the main report.

The sub report I include in the Detail section of the main report, for it is the one that is going to display the data.

When I run the main report it gets the sub report, passes and adds the data onto the sub report, but for some reason it removes the first row from the data set in the sub report. So in the end it starts showing data from the second row in the sub report. When I do not include a sub report and put the fields directly into the detail of the main report it show all the rows.

I have tried increasing the size/height and width of both the reports details section but it still removes the first row in the sub report. I do not know what to try next to see what the problem might be.

Is there configuration I need to set for the sub report to get this to work?

Main report detail section:

<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>

Sub report:

<?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>

Solution

  • I finally got the answer.

    What I needed was to pass the $P{REPORT_CONNECTION} to my sub report which mean each report can have its own query. Main and all sub reports

    Steps:

    1. Have a query on my main report for itself
    2. Create a sub report, by dragging from the palette.
    3. On sub report properties. Set use connection expression
    4. On sub report properties. Use $P{REPORT_CONNECTION} value
    5. Open the sub report via the main report, i.e. right click on the sub report tag on the main report and click open sub report. For some reason when I did this it opened the same sub report but it showed non of the changes I made when I opened it separately. I think this is where the change came in because after I made the changes on the one I opened like this all worked 100%.

    Thanks for all your suggestions