Jump to content
Changes to the Jaspersoft community edition download ×

Subreport won't show


2004 IR Help

Recommended Posts

By: Xeno - xenoryet

Subreport won't show

2004-10-18 11:24

I have a report that calls a subreport. I created the subreport by following the tutorial. Both the Master and Subreport compile fine, and when run independantly, both get data in them. However when I try to run them together the subreport doesn't show up. All the other feilds from the master report show normaly, but the subreport just isn't there.

 

This is using iReports 0.4.0 btw.

 

Anyone got any clues?

 

 

 

 

By: Xeno - xenoryet

RE: Subreport won't show

2004-10-18 14:02

OK, I'm posting the XML code in the hopes that it will prompt some helpful advice.

 

Master Report

---------------------------------------------------------------------

<?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="SimpleMaster"

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

<property name="ireport.scriptlethandling" value="2" />

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="7"

y="14"

width="512"

height="74"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="true"

isPrintWhenDetailOverflows="true"/>

<subreportExpression class="java.lang.String"><![CDATA["C:\iReport-0.4.0\simplesub.jasper"]]></subreportExpression>

</subreport>

</band>

</detail>

<columnFooter>

<band height="30" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</pageFooter>

<lastPageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</lastPageFooter>

<summary>

<band height="50" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

---------------------------------------------------------------------------

 

 

Subreport

---------------------------------------------------------------------------

<?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="SimpleSub"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="612"

pageHeight="792"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="3"

y="3"

width="165"

height="39"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="true"

isPrintWhenDetailOverflows="true"/>

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

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

</band>

</detail>

<columnFooter>

<band height="30" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</pageFooter>

<lastPageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</lastPageFooter>

<summary>

<band height="50" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

-------------------------------------------------------------------------------------

 

 

 

 

By: Rick Millar - rmillar

RE: Subreport won't show

2004-10-18 14:47

Take a look at the XML below. I made a few changes to get your subreport to work.

 

1. path expression for your subreport did not have the backslashes properly escaped, so I did that.

 

2. I added dummy sql queries to your report and subreport. I don't believe reports return anything if all you have are static fields and no sql query

 

3. changed the subreport connection expression in the master report to "use connection expression"

 

4. You may want to consider putting the subreport element into its own group band to give you more flexibility. Also, the height of the subreport element is not important since it will expand as much as needed based upon the subreport size itself.

=======master report============

 

<?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="SimpleMaster"

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

<queryString><![CDATA[select 'moreStuff'

from dual]]></queryString>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="7"

y="14"

width="512"

height="2"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="true"

isPrintWhenDetailOverflows="true"/>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA["C:\jasperfiles\test\simplesub.jasper"]]></subreportExpression>

</subreport>

</band>

</detail>

<columnFooter>

<band height="30" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="104" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

========subreport===========

 

<?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="SimpleSub"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="612"

pageHeight="792"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<queryString><![CDATA[select 'stuff'

from dual]]></queryString>

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

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="100" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="3"

y="3"

width="165"

height="39"

forecolor="#000000"

backcolor="#FFFFFF"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="true"

isPrintWhenDetailOverflows="true"/>

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

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

</band>

</detail>

<columnFooter>

<band height="30" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="50" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="50" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

 

 

 

By: Rick Millar - rmillar

RE: Subreport won't show

2004-10-18 14:51

I don't know if you cam across this thread in you searches of this forum, but it may help you too.

 

https://sourceforge.net/forum/message.php?msg_id=2635951

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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