Jump to content
JasperReports Library 7.0 is now available ×

V..Urgent...Sub-Report overwriting!


2005 IR Help

Recommended Posts

By: Joey - joeyfeet

V..Urgent...Sub-Report overwriting!

2004-05-03 05:50

 

Hi all!

 

I have create a Report where I've two Sub-Reports "A.jasper" and "B.jasper" included in a Master Report i.e. "Master.jasper". I am passing the DataSource to there two Sub-Reports from the Master report using Data Source Expression. This part is working fine and the two reports get populated with the data perfectly.

 

I have included the two-subreports in two different Groups i.e. "AGroup (for Sub-Report A)" and "BGroup" (for Sub-Report B) in the the Master report one followed by another.

 

However when the first sub-report (A) has around 20 records the resulting output is fine but when it exceeds 20 the below sub-report (B) again overwrites itself!

Also if we exceed the number of Records for Sub-Report A in order to have Multiple-Pages for sun-report A it doesn't do so.Instead the Sub-Report A is retricted to only first page when the records exceeds it starts Overwriting the Same first Page making the Output a complete MESS.

 

This is the skeleton structure of the rpt:

 

Master Report Starts++++++++

 

<AGroup >

SubReport A

<AGroup Ends>

 

<BGroup>

SubReport B

</BGroup Ends>

 

Static Text in Master Report

 

 

Master Report Ends++++++++++

 

 

 

Please have a look at the below given Master Report's XML file:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="MasterReport"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="515"

columnSpacing="0"

leftMargin="40"

rightMargin="40"

topMargin="50"

bottomMargin="50"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<parameter name="ASubreport" isForPrompting="true" class="dori.jasper.engine.JasperReport"/>

<parameter name="BSubreport" isForPrompting="true" class="dori.jasper.engine.JasperReport"/>

<parameter name="ADataSource" isForPrompting="true" class="dori.jasper.engine.JRDataSource"/>

<parameter name="BDataSource" isForPrompting="true" class="dori.jasper.engine.JRDataSource"/>

<field name="City" class="java.lang.String"/>

<group name="ConditionGroup" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="60" >

<groupExpression><![CDATA[

$F{City}

]]></groupExpression>

<groupHeader>

<band height="40">

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="7"

y="3"

width="325"

height="20"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="false"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="true"/>

<subreportParameter name="City">

<subreportParameterExpression><![CDATA[$F{City}]]></subreportParameterExpression>

</subreportParameter>

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

<subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{ASubreport}]]></subreportExpression>

</subreport>

</band>

</groupHeader>

<groupFooter>

<band height="0">

</band>

</groupFooter>

</group>

<group name="PremiumGroup" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" >

<groupExpression><![CDATA[

$F{City}

]]></groupExpression>

<groupHeader>

<band height="50">

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="7"

y="3"

width="325"

height="21"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="false"

isRemoveLineWhenBlank="true"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportParameter name="City">

<subreportParameterExpression><![CDATA[$F{City}]]></subreportParameterExpression>

</subreportParameter>

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

<subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{BSubreport}]]></subreportExpression>

</subreport>

</band>

</groupHeader>

<groupFooter>

<band height="0">

</band>

</groupFooter>

</group>

<background>

<band height="0">

</band>

</background>

<title>

<band height="0">

</band>

</title>

<pageHeader>

<band height="0">

</band>

</pageHeader>

<columnHeader>

<band height="0">

</band>

</columnHeader>

<detail>

<band height="0">

</band>

</detail>

<columnFooter>

<band height="0">

</band>

</columnFooter>

<pageFooter>

<band height="0">

</band>

</pageFooter>

<summary>

<band height="70">

<staticText>

<reportElement

mode="Opaque"

x="7"

y="27"

width="123"

height="42"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="Arial_Normal" size="9"/>

</textElement>

<text><![CDATA[signature]]></text>

</staticText>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="136"

y="66"

width="132"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</line>

<staticText>

<reportElement

mode="Opaque"

x="279"

y="56"

width="43"

height="14"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single">

<font reportFont="Arial_Normal" size="9"/>

</textElement>

<text><![CDATA[Examined]]></text>

</staticText>

<line direction="TopDown">

<reportElement

mode="Opaque"

x="330"

y="66"

width="50"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</line>

</band>

</summary>

</jasperReport>

 

 

I wud really appreciate if any 1 can b a source of help for me.

 

 

Thankz a loadz before hand

Joey

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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