By: Hamza MEahmmed - hamzam
Multipage subreports
2003-06-10 05:47
Hello all,
I am trying to build subreports which have JTabel as a Datasource, i get the follwing problem:
i have 2 reports one Master(Tps_0.xml) and one Child(Tps_1.xml).
When i Compile and fill separatly it works (i.e i get one page for Maste which have only title and 3 pages for Child for JTable.
When i compile as Master and Child as subreport i get only 2 pages, one for Master and one for Child without the content from JTable.
i used to compile the Master the following Code:
JasperCompileManager.compileReportToFile("Tps_0.xml");
JasperFillManager.fillReportToFile("Tps_0.jasper", null, new JREmptyDataSource());
For ths Child one:
JasperCompileManager.compileReportToFile("Tps_1.xml");
JasperFillManager.fillReportToFile("Tps_1.jasper", null, new JRTableModelDataSource(new CustomTableModel()));
The necessary files are attached.
What am i doing wrong?
Thaks for your help.
==================================
MASTER
==================================
<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Created with iReport - A designer for JasperReports
-->
<!DOCTYPE jasperReport (View Source for full doctype...)>
- <jasperReport name="Tps_0" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false">
- <group name="tps1" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0">
<groupExpression />
- <groupHeader>
<band height="50" />
</groupHeader>
- <groupFooter>
- <band height="500">
- <subreport isUsingCache="true">
<reportElement mode="Opaque" x="58" y="52" width="391" height="411" forecolor="#000000" backcolor="#8000FF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <subreportExpression class="java.lang.String">
- <![CDATA[ "c:\\_MISC\\TPS\\TPS_V1\\com\\systerion\\tps\\JasperFiles\\Tps_1.jasper"
]]>
</subreportExpression>
</subreport>
</band>
</groupFooter>
</group>
- <title>
- <band height="50">
- <staticText>
<reportElement mode="Transparent" x="127" y="10" width="188" height="29" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Left" lineSpacing="Single" verticalAlignment="Top">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false" isStrikeThrough="false" />
</textElement>
- <text>
- <![CDATA[ Master Title
]]>
</text>
</staticText>
</band>
</title>
- <pageHeader>
<band height="50" />
</pageHeader>
- <columnHeader>
<band height="30" />
</columnHeader>
- <detail>
- <band height="50">
- <staticText>
<reportElement mode="Transparent" x="86" y="10" width="126" height="23" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Left" lineSpacing="Single" verticalAlignment="Top">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false" isStrikeThrough="false" />
</textElement>
- <text>
- <![CDATA[ Master Detail
]]>
</text>
</staticText>
</band>
</detail>
- <columnFooter>
<band height="30" />
</columnFooter>
- <pageFooter>
<band height="50" />
</pageFooter>
- <summary>
<band height="50" />
</summary>
</jasperReport>
================================================
CHILD
=================================================
<?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="Tps_1"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail"
isTitleNewPage="false"
isSummaryNewPage="false">
<field name="Name" class="java.lang.String"/>
<title>
<band height="50">
<staticText>
<reportElement
mode="Transparent"
x="167"
y="11"
width="147"
height="25"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />
</textElement>
<text><![CDATA[child _1]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="25">
</band>
</pageHeader>
<columnHeader>
<band height="30">
</band>
</columnHeader>
<detail>
<band height="50">
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="50"
y="14"
width="83"
height="22"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$F{Name}</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="30">
</band>
</columnFooter>
<pageFooter>
<band height="50">
</band>
</pageFooter>
<summary>
<band height="50">
</band>
</summary>
</jasperReport>
================
END
=====================
By: Hamza MEahmmed - hamzam
RE: Multipage subreports
2003-06-16 04:03
Hi Teodor,
Can you please tell me, how this <dataSourceExpresion> in this case looks like and where it has to be placed.
The subReport is working nice as stand alone.
Thanks,
Hamza
By: Teodor Danciu - teodord
RE: Multipage subreports
2003-06-15 13:22
Hi,
Where are you passing the data source to your subreport?
I don't see the <dataSourceExpression> tag being used in your
<subreport> element.
I hope this helps.
Teodor
By: Ahsa - asha_2000
RE: Multipage subreports
2003-11-12 02:15
Can u tell me how to pass the datasource to subreport. Atleast point me some link.... Urgent please
Multipage subreports
2003-06-10 05:47
Hello all,
I am trying to build subreports which have JTabel as a Datasource, i get the follwing problem:
i have 2 reports one Master(Tps_0.xml) and one Child(Tps_1.xml).
When i Compile and fill separatly it works (i.e i get one page for Maste which have only title and 3 pages for Child for JTable.
When i compile as Master and Child as subreport i get only 2 pages, one for Master and one for Child without the content from JTable.
i used to compile the Master the following Code:
JasperCompileManager.compileReportToFile("Tps_0.xml");
JasperFillManager.fillReportToFile("Tps_0.jasper", null, new JREmptyDataSource());
For ths Child one:
JasperCompileManager.compileReportToFile("Tps_1.xml");
JasperFillManager.fillReportToFile("Tps_1.jasper", null, new JRTableModelDataSource(new CustomTableModel()));
The necessary files are attached.
What am i doing wrong?
Thaks for your help.
==================================
MASTER
==================================
<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Created with iReport - A designer for JasperReports
-->
<!DOCTYPE jasperReport (View Source for full doctype...)>
- <jasperReport name="Tps_0" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false">
- <group name="tps1" isStartNewColumn="false" isStartNewPage="true" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0">
<groupExpression />
- <groupHeader>
<band height="50" />
</groupHeader>
- <groupFooter>
- <band height="500">
- <subreport isUsingCache="true">
<reportElement mode="Opaque" x="58" y="52" width="391" height="411" forecolor="#000000" backcolor="#8000FF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <subreportExpression class="java.lang.String">
- <![CDATA[ "c:\\_MISC\\TPS\\TPS_V1\\com\\systerion\\tps\\JasperFiles\\Tps_1.jasper"
]]>
</subreportExpression>
</subreport>
</band>
</groupFooter>
</group>
- <title>
- <band height="50">
- <staticText>
<reportElement mode="Transparent" x="127" y="10" width="188" height="29" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Left" lineSpacing="Single" verticalAlignment="Top">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false" isStrikeThrough="false" />
</textElement>
- <text>
- <![CDATA[ Master Title
]]>
</text>
</staticText>
</band>
</title>
- <pageHeader>
<band height="50" />
</pageHeader>
- <columnHeader>
<band height="30" />
</columnHeader>
- <detail>
- <band height="50">
- <staticText>
<reportElement mode="Transparent" x="86" y="10" width="126" height="23" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />
- <textElement textAlignment="Left" lineSpacing="Single" verticalAlignment="Top">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false" isStrikeThrough="false" />
</textElement>
- <text>
- <![CDATA[ Master Detail
]]>
</text>
</staticText>
</band>
</detail>
- <columnFooter>
<band height="30" />
</columnFooter>
- <pageFooter>
<band height="50" />
</pageFooter>
- <summary>
<band height="50" />
</summary>
</jasperReport>
================================================
CHILD
=================================================
<?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="Tps_1"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail"
isTitleNewPage="false"
isSummaryNewPage="false">
<field name="Name" class="java.lang.String"/>
<title>
<band height="50">
<staticText>
<reportElement
mode="Transparent"
x="167"
y="11"
width="147"
height="25"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />
</textElement>
<text><![CDATA[child _1]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="25">
</band>
</pageHeader>
<columnHeader>
<band height="30">
</band>
</columnHeader>
<detail>
<band height="50">
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="50"
y="14"
width="83"
height="22"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="sansserif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$F{Name}</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="30">
</band>
</columnFooter>
<pageFooter>
<band height="50">
</band>
</pageFooter>
<summary>
<band height="50">
</band>
</summary>
</jasperReport>
================
END
=====================
By: Hamza MEahmmed - hamzam
RE: Multipage subreports
2003-06-16 04:03
Hi Teodor,
Can you please tell me, how this <dataSourceExpresion> in this case looks like and where it has to be placed.
The subReport is working nice as stand alone.
Thanks,
Hamza
By: Teodor Danciu - teodord
RE: Multipage subreports
2003-06-15 13:22
Hi,
Where are you passing the data source to your subreport?
I don't see the <dataSourceExpression> tag being used in your
<subreport> element.
I hope this helps.
Teodor
By: Ahsa - asha_2000
RE: Multipage subreports
2003-11-12 02:15
Can u tell me how to pass the datasource to subreport. Atleast point me some link.... Urgent please
0 Answers:
No answers yet