Jump to content
JasperReports Library 7.0 is now available ×

subreports not shown


Recommended Posts

By: Liheng Qiao - qlheng

subreports not shown

2003-07-22 15:09

Hi!

 

I'm trying to create a report which consists two subreports. Although I can 'view' both subreports after filling, I can't see the master report. The viewer simply poped up a dialog saying "The document has no pages.". The following is the design file of the master report. Can you tell me what I'm doing is wrong?

 

 

<?xml version="1.0"?>

 

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

 

 

 

<jasperReport

 

name="CustomForms"

 

columnCount="1"

 

printOrder="Vertical"

 

pageWidth="540"

 

pageHeight="216"

 

columnWidth="540"

 

columnSpacing="5"

 

leftMargin="0"

 

rightMargin="0"

 

topMargin="0"

 

bottomMargin="0"

 

isTitleNewPage="false"

 

isSummaryNewPage="false">

 

<reportFont name="Sans-serif_Normal" isDefault="true" fontName="Sans-serif" size="8" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

 

<reportFont name="Sans-serif_Bold" isDefault="false" fontName="Sans-serif" size="8" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

 

<reportFont name="Sans-serif_Italic" isDefault="false" fontName="Sans-serif" size="8" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

 

<parameter name="OWDOrderNum" class="java.lang.Integer"/>

 

 

<variable name="TotalValue" class="java.lang.Double" resetType="Report" calculation="Sum">

 

<variableExpression>

 

new Double(($F{price}.doubleValue())*($F{quantity_actual}.intValue()))

</variableExpression>

 

</variable>

 

<pageHeader>

<band height="99"/>

</pageHeader>

<detail>

 

<band height="96">

 

<subreport isUsingCache="true">

<reportElement x="0" y="0" width="162" height="79" backcolor="white" positionType="Float" isRemoveLineWh

enBlank="true"/>^M

<subreportParameter name="OWDOrderNum">^M

<subreportParameterExpression>^M

$F{OWDOrderNum}^M

</subreportParameterExpression>^M

</subreportParameter>^M

<connectionExpression>^M

$P{REPORT_CONNECTION}^M

</connectionExpression>^M

<subreportExpression class="java.lang.String">^M

"ProductSubReport.jasper"^M

</subreportExpression>^M

</subreport>^

<subreport isUsingCache="true">

<reportElement x="162" y="10" width="324" height="86" backcolor="white" positionType="Float" isRemoveLineWh

enBlank="true"/>^M

<subreportParameter name="OWDOrderNum">^M

<subreportParameterExpression>^M

$F{OWDOrderNum}^M

</subreportParameterExpression>^M

</subreportParameter>^M

<connectionExpression>^M

$P{REPORT_CONNECTION}^M

</connectionExpression>^M

<subreportExpression class="java.lang.String">^M

"AddressSubReport.jasper"^M

</subreportExpression>

</subreport>

</band>

</detail>

 

<pageFooter>

<band height="21">

<image isUsingCache="true">

 

<reportElement x="0" y="5" width="142" height="15">

</reportElement>

<imageExpression class="java.lang.String">

 

"doug.jpg"

</imageExpression>

</image>

 

<image isUsingCache="true">

 

<reportElement x="150" y="5" width="210" height="15">

</reportElement>

<imageExpression class="java.lang.String">

 

"doug.jpg"

</imageExpression>

</image>

 

<textField patter="MM/dd/yyyy">

 

<reportElement x="370" y="5" width="80" height="15">

</reportElement>

<textElement textAlignment="Center" verticalAlignment="Middle">

 

<font reportFont="Sans-serif_Bold"/>

 

</textElement>

 

<textFieldExpression class="java.util.Date">

 

(new GregorianCalendar()).getTime()

</textFieldExpression>

 

</textField>

 

</band>

 

</pageFooter>

 

</jasperReport>

 

 

 

 

 

 

By: Liheng Qiao - qlheng

RE: subreports not shown

2003-07-24 06:23

Please help. I set the whenNoDataType to "AllSectionsNoDetail" and I can see the master report shown. But nothing showed up for those two subreports. However, I can fill and view them separately without any problem.

 

 

 

 

By: Liheng Qiao - qlheng

RE: subreports not shown

2003-07-24 14:37

Though a little disappointed that nobody helped, I'm glad I found the problem. It seems that if the master report doesn't have a query to run, the connection object won't be passed (be closed?) to the subreports.

 

 

 

 

By: Teodor Danciu - teodord

RE: subreports not shown

2003-10-04 12:38

 

Hi,

 

No, is not that.

If the master does not have a query of its own or

a data source, it has nothing to iterate on and the

detail section won't be generated.

Since you placed your subreports in the detail,

they will never be called.

Consider placing them elswhere or supply at least

one record to your master probably using

new JREmpyDataSource(1) and passing the

connection as parameter.

 

I hope this helps.

Teodor

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