Jump to content
Changes to the Jaspersoft community edition download ×

SubReports not properly called


2004 IR Help

Recommended Posts

By: Francesco Galli - wereboar

SubReports not properly called

2005-05-18 05:42

Greetings,

i'm new to JasperReports and I'm using it along with iReport as a jrxml generation tool.

 

Here is my problem:

 

I've generated a report that runs fine. I need a subreport in the detail band: I've generated the subreport (which in turn runs fine) and placed the subreport in the report.

 

When I run the master report, however, the subreport does not show at all.

 

What have I done wrong? The subreport declaration in the master report is below:

 

<subreport isUsingCache="true">

<reportElement

mode="Opaque"

x="142"

y="96"

width="631"

height="75"

forecolor="#000000"

backcolor="#CCCCCC"

key="subreport-1"

stretchType="NoStretch"

positionType="Float"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportParameter name="id_commission">

 

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

terExpression>

</subreportParameter>

<subreportExpression

class="java.lang.String"><![CDATA["CommissionCompareMonths.jasper"]]></subre

portExpression>

</subreport>

 

and the subreport (total) is below:

 

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

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="842"

pageHeight="595"

columnWidth="782"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

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

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

<parameter name="id_commission" isForPrompting="false"

class="java.lang.Integer">

<parameterDescription><![CDATA[COmmission ID]]></parameterDescription>

</parameter>

<queryString><![CDATA[sELECT distinct

commission.id_commission,

discharge.year,

discharge.month,

abs(year(commission.creation_date)*12+month(commission.creation_date) -

(discharge.year * 12) - discharge.month) +1 as

 

progressivo

FROM

commission

inner join discharge USING (id_commission)

where commission.id_commission = $P!{id_commission}

GROUP BY

commission.id_commission, discharge.year, discharge.month

]]></queryString>

<field name="id_commission" class="java.lang.Integer"/>

<field name="year" class="java.lang.Integer"/>

<field name="month" class="java.lang.Integer"/>

<field name="progressivo" class="java.lang.Long"/>

<variable name="test" class="java.lang.String" resetType="None"

calculation="Nothing">

<variableExpression><![CDATA["test"]]></variableExpression>

<initialValueExpression><![CDATA["test" ]]></initialValueExpression>

</variable>

<background>

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

</band>

</background>

<title>

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

</band>

</title>

<pageHeader>

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

</band>

</pageHeader>

<columnHeader>

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

<staticText>

<reportElement

mode="Transparent"

x="0"

y="3"

width="195"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

<staticText>

<reportElement

mode="Transparent"

x="195"

y="3"

width="195"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

<staticText>

<reportElement

mode="Transparent"

x="390"

y="3"

width="195"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

<staticText>

<reportElement

mode="Transparent"

x="585"

y="3"

width="195"

height="17"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

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

</staticText>

</band>

</columnHeader>

<detail>

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

<textField isStretchWithOverflow="false" pattern=""

isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"

hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="0"

y="2"

width="195"

height="16"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression

class="java.lang.Integer"><![CDATA[$F{id_commission}]]></textFieldExpression

>

</textField>

<textField isStretchWithOverflow="false" pattern=""

isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"

hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="195"

y="2"

width="195"

height="16"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression

class="java.lang.Integer"><![CDATA[$F{year}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern=""

isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"

hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="390"

y="2"

width="195"

height="16"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression

class="java.lang.Integer"><![CDATA[$F{month}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern=""

isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"

hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="585"

y="2"

width="195"

height="16"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None"

leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF"

bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top"

rotation="None" lineSpacing="Single">

<font fontName="Helvetica" pdfFontName="Helvetica" size="12"

isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false"

pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression

class="java.lang.Long"><![CDATA[$F{progressivo}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

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

</band>

</columnFooter>

<pageFooter>

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

</band>

</pageFooter>

<summary>

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

</band>

</summary>

</jasperReport>

 

please help me, I'm a poor clueless newbie :-)

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