By: Jeff Cooper - jcooper
Help, what am I doing wrong with subreports
2002-11-12 05:18
I am trying to design a report where the main report prints out information on an account and the subreport will print out any jobs for that account. Here is what I have for my master repor (I'll just copy the subreport section):
<subreport isUsingCache="true">
<reportElement
mode="Transparent"
x="1"
y="34"
width="526"
height="41"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="true"
isPrintWhenDetailOverflows="false"/>
<connectionExpression>
$P{REPORT_CONNECTION}
</connectionExpression>
<subreportExpression class="java.lang.String">
"Jobs.jasper"
</subreportExpression>
</subreport>
And here is the 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="Jobs"
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">
<parameter name="AccountId" isForPrompting="false" class="java.lang.Integer"/>
<queryString><![CDATA[
SELECT Job.Summary from Job where Job.Id = $P{AccountId}
]]></queryString>
<field name="Summary" class="java.lang.String"/>
<variable name="test" class="java.lang.String" resetType="None" calculation="Nothing">
<variableExpression>"test"</variableExpression>
<initialValueExpression>"test" </initialValueExpression>
</variable>
<title>
<band height="3">
</band>
</title>
<pageHeader>
<band height="9">
</band>
</pageHeader>
<columnHeader>
<band height="0">
</band>
</columnHeader>
<detail>
<band height="26">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="126"
y="4"
width="398"
height="15"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Times-Roman" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$F{Summary}</textFieldExpression>
</textField>
<staticText>
<reportElement
mode="Transparent"
x="0"
y="10"
width="127"
height="15"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Times-Bold" size="12" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Job]]></text>
</staticText>
</band>
</detail>
<columnFooter>
<band height="0">
</band>
</columnFooter>
<pageFooter>
<band height="27">
</band>
</pageFooter>
<summary>
<band height="0">
</band>
</summary>
</jasperReport>
I modified the subreportapp to use my files and did the following, ant javac, ant compile, ant fill, and finally ant pdf. The only data that is printing out are the accounts but not the jobs associated with the accounts.
Thanks for any help,
Jeff Cooper
By: Sofiane - sofianito
RE: Help, what am I doing wrong with subrepor
2002-11-12 08:05
I think u have to specify the full path of jobs.jasper, i had the same problem with images, i introduced a parameter in the master report which the base directory where the images where located.
good luck
Sofiane
By: Jeffrey S. Cooper - jscooper
RE: Help, what am I doing wrong with subreports
2002-11-12 09:10
Just tried putting in the path to the subreport; but no, it's still not printing out the subreport records.
Thanks,
Jeff Cooper
By: Giulio Toffoli - gt78
RE: Help, what am I doing wrong with subreports
2002-11-13 13:52
You must add a subreport parameter to pass the value of AccountID to the subreport.
Giulio
Help, what am I doing wrong with subreports
2002-11-12 05:18
I am trying to design a report where the main report prints out information on an account and the subreport will print out any jobs for that account. Here is what I have for my master repor (I'll just copy the subreport section):
<subreport isUsingCache="true">
<reportElement
mode="Transparent"
x="1"
y="34"
width="526"
height="41"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="true"
isPrintWhenDetailOverflows="false"/>
<connectionExpression>
$P{REPORT_CONNECTION}
</connectionExpression>
<subreportExpression class="java.lang.String">
"Jobs.jasper"
</subreportExpression>
</subreport>
And here is the 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="Jobs"
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">
<parameter name="AccountId" isForPrompting="false" class="java.lang.Integer"/>
<queryString><![CDATA[
SELECT Job.Summary from Job where Job.Id = $P{AccountId}
]]></queryString>
<field name="Summary" class="java.lang.String"/>
<variable name="test" class="java.lang.String" resetType="None" calculation="Nothing">
<variableExpression>"test"</variableExpression>
<initialValueExpression>"test" </initialValueExpression>
</variable>
<title>
<band height="3">
</band>
</title>
<pageHeader>
<band height="9">
</band>
</pageHeader>
<columnHeader>
<band height="0">
</band>
</columnHeader>
<detail>
<band height="26">
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" > <reportElement
mode="Transparent"
x="126"
y="4"
width="398"
height="15"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Times-Roman" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<textFieldExpression class="java.lang.String">$F{Summary}</textFieldExpression>
</textField>
<staticText>
<reportElement
mode="Transparent"
x="0"
y="10"
width="127"
height="15"
forecolor="#000000"
backcolor="#FFFFFF"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="false"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false"/>
<textElement textAlignment="Left" lineSpacing="Single">
<font fontName="" pdfFontName="Times-Bold" size="12" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1250" isStrikeThrough="false" />
</textElement>
<text><![CDATA[Job]]></text>
</staticText>
</band>
</detail>
<columnFooter>
<band height="0">
</band>
</columnFooter>
<pageFooter>
<band height="27">
</band>
</pageFooter>
<summary>
<band height="0">
</band>
</summary>
</jasperReport>
I modified the subreportapp to use my files and did the following, ant javac, ant compile, ant fill, and finally ant pdf. The only data that is printing out are the accounts but not the jobs associated with the accounts.
Thanks for any help,
Jeff Cooper
By: Sofiane - sofianito
RE: Help, what am I doing wrong with subrepor
2002-11-12 08:05
I think u have to specify the full path of jobs.jasper, i had the same problem with images, i introduced a parameter in the master report which the base directory where the images where located.
good luck
Sofiane
By: Jeffrey S. Cooper - jscooper
RE: Help, what am I doing wrong with subreports
2002-11-12 09:10
Just tried putting in the path to the subreport; but no, it's still not printing out the subreport records.
Thanks,
Jeff Cooper
By: Giulio Toffoli - gt78
RE: Help, what am I doing wrong with subreports
2002-11-13 13:52
You must add a subreport parameter to pass the value of AccountID to the subreport.
Giulio
0 Answers:
No answers yet