Jump to content
Changes to the Jaspersoft community edition download ×

Subreports Overlap each other


kazunkatthidiya01

Recommended Posts

I have a question regarding the subreports. Requirement is to have 3 subreports one below another.

when subreports run ,if 2nd sub reprt has more details it overlap oneach...this my code
 

<?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="PayR1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3fda54b9-ddbd-4deb-b45a-6b3c6397edbb">
    <property name="ireport.zoom" value="1.5"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="257"/>
    <style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
    <style name="Sans_Bold" fontName="DejaVu Sans" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
    <style name="Sans_Italic" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
    <style name="Title" fontName="Arial" fontSize="26" isBold="true" pdfFontName="Helvetica-Bold"/>
    <style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
    <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
    <style name="Detail" fontName="Arial" fontSize="12"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["C:\PHMotors System\Jasper Report\"]]></defaultValueExpression>
    </parameter>
    <parameter name="JOB_ID" class="java.lang.Integer"/>
    <queryString>
        <![CDATA[sELECT * FROM vehiclepartsadded WHERE jobid = $P{JOB_ID}]]>
    </queryString>
    <field name="id" class="java.lang.Integer">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="jobId" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="vehicleNo" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="ownerName" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="brandName" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="model" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="partCode" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="partName" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="partBrand" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="qty" class="java.lang.Integer">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="price" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="date" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="109" splitType="Stretch">
            <rectangle>
                <reportElement x="0" y="72" width="555" height="35" uuid="9de690ec-7d49-4ce9-9ee1-57c912e91238"/>
                <graphicElement>
                    <pen lineWidth="0.75" lineStyle="Double"/>
                </graphicElement>
            </rectangle>
            <staticText>
                <reportElement style="Title" x="-2" y="3" width="263" height="33" uuid="c0683b94-ab86-4930-b2c1-17527395b0cc"/>
                <textElement verticalAlignment="Middle"/>
                <text><![CDATA[PH MOTORS]]></text>
            </staticText>
            <staticText>
                <reportElement style="SubTitle" x="98" y="36" width="174" height="22" uuid="c6c394d7-a02e-42b8-8eb7-35fdda6f936a"/>
                <text><![CDATA[Leaf Green SubTitle]]></text>
            </staticText>
            <staticText>
                <reportElement style="Column header" x="11" y="82" width="76" height="15" uuid="c7bb8bfd-045b-45cd-a74b-4e3b3b4d26e2"/>
                <text><![CDATA[VEHICLE NO]]></text>
            </staticText>
            <textField>
                <reportElement style="Detail" x="116" y="82" width="76" height="15" uuid="1e724c47-4175-4669-a151-d015741f825e"/>
                <textFieldExpression><![CDATA[$F{vehicleNo}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement style="Column header" x="237" y="82" width="68" height="15" uuid="c5a075ff-ea79-44f3-abc0-67aa82ca7d68"/>
                <text><![CDATA[bRAND NAME]]></text>
            </staticText>
            <textField>
                <reportElement style="Detail" x="305" y="82" width="68" height="15" uuid="fc38a64b-d0e9-4045-9a56-dbc47b252440"/>
                <textFieldExpression><![CDATA[$F{brandName}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement style="Detail" x="479" y="82" width="71" height="15" uuid="8339f9af-9b2a-4212-aaa5-96f757d5eb94"/>
                <textFieldExpression><![CDATA[$F{model}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement style="Column header" x="408" y="82" width="71" height="15" uuid="c8bf2c8d-d321-4e5e-8ca3-a7b89f5cb061"/>
                <text><![CDATA[MODEL]]></text>
            </staticText>
        </band>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="11" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="6" width="555" height="1" uuid="45446c75-aa26-4d6a-8c53-9fb48c24796b"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
        </band>
    </columnHeader>
    <columnFooter>
        <band height="34" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="648" splitType="Stretch">
            <textField>
                <reportElement style="Column header" x="433" y="0" width="80" height="20" uuid="96887b13-bf5e-4db6-86c1-0eef41017539"/>
                <textElement textAlignment="Right">
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement style="Column header" x="513" y="0" width="40" height="20" uuid="b55da68d-855b-4e66-b3b6-e2f18af717da"/>
                <textElement>
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField pattern="EEEEE dd MMMMM yyyy">
                <reportElement style="Column header" x="0" y="0" width="197" height="20" uuid="0416869c-6608-4f9a-8767-e2448e8f84a2"/>
                <textElement>
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <subreport>
                <reportElement positionType="Float" x="35" y="41" width="200" height="37" uuid="1a5b0b8a-52e9-44e2-9ea2-4553db7b93a8"/>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="JOB_ID">
                    <subreportParameterExpression><![CDATA[$P{JOB_ID}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "PayR1_subreport4.jasper"]]></subreportExpression>
            </subreport>
            <subreport>
                <reportElement x="35" y="102" width="200" height="39" uuid="da1557e3-9929-4c49-97fc-0a134d00f11c"/>
                <subreportParameter name="JOB_ID"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA["C:\PHMotors System\Jasper Report\PayR1_subreport2.jasper"]]></subreportExpression>
            </subreport>
            <subreport>
                <reportElement x="35" y="169" width="197" height="40" uuid="56e5c22e-c678-4797-9169-f459ed603382"/>
                <subreportParameter name="SUBREPORT_DIR">
                    <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="JOB_ID">
                    <subreportParameterExpression><![CDATA[$P{JOB_ID}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "PayR1_subreport3.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </pageFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>

 

 

i called datas from 3 tables of database for  3 subreports

anybody can help me
 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Hi kazun.....

There could be a couple of reasons for this. 
• Some of your subreport might not be getting any data, to test, make sure you set the report's proprerty "When No Data Type" = All Sections with Detail, ensure you have some hard code text fields in the subreports, so you can just test if this the case. 

• So when you work on the subreport jrxml and you safe, remember to compile in jasperstudio so the .jasper is updated. 

• Also I did not ask, but I am assuming that you are getting the issues in jasperstudio and have not yet deployed to JaserServer, as with jasperserver you need to make some setup before they will work.

• Could be the last page Footer causing this. So either use in Summary or create a dummmyGroup and make use of dummyGroup Header or Footer Section.

Hope this helps

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...