Jump to content
Changes to the Jaspersoft community edition download ×

Second Sub report does not show up?


Recommended Posts

By: Raj - rajs1

Second Sub report does not show up?

2002-11-17 06:14

I have a Master Report as:

 

<jasperReport name="TradeTicket"

columnCount="1"

printOrder="Vertical"

pageHeight="800"

pageWidth="600"

columnWidth="520"

leftMargin="40"

rightMargin="40"

topMargin="20"

bottomMargin="20"

isTitleNewPage="false"

isSummaryNewPage="false">

 

...

...

<group name="TTGroup">

<groupExpression/>

<groupHeader>

<band height="260">

<subreport isUsingCache="true">

<reportElement x="0" y="0" width="520" height="120"/>

<dataSourceExpression>

$P{ReportDataSource}

</dataSourceExpression>

<subreportExpression class="dori.jasper.engine.JasperReport">

$P{SecuritySubreport}

</subreportExpression>

</subreport>

<subreport isUsingCache="true">

<reportElement x="0" y="140" width="520" height="120"/>

<dataSourceExpression>

$P{ReportDataSource}

</dataSourceExpression>

<subreportExpression class="dori.jasper.engine.JasperReport">

$P{TransactionSubreport}

</subreportExpression>

</subreport>

</band>

</groupHeader>

<groupFooter>

<band height="0"/>

</groupFooter>

</group>

...

</jasperReport>

 

 

Both sub-report have the following setting:

 

<jasperReport name="SecuritySubreport"

pageHeight="120"

pageWidth="520"

columnWidth="520"

leftMargin="0"

rightMargin="0"

topMargin="0"

bottomMargin="0">

 

(with different report names of cours) and display various stuff.

 

The curious thing is that only the first sub report is displayed. Even if the switch the order of display of the sub-reports, this continues to be the case.

 

Any pointers would be appreciated.

 

PS: I have been through the MasterReport /AddressReport sample and as far as I can see I do more or less the same. Only difference is that I pass in my on ReportDataSource object instead of the Report_Connection.

 

Cheers

-raj

 

 

 

By: Teodor Danciu - teodord

RE: Second Sub report does not show up?

2002-11-17 12:15

 

Hi,

 

The problem is that you supply the same data

source instance to both your subreports.

After the first subreport was generated, the internal

pointer of the data source has already reached the

last record and remains there.

This is why for your second subreport it looks like

the data source has no records in it.

You have to find a way to move the internal pointer

of your custom data source before the first record

again, so that the iteration can take place

a second time.

 

I hope this helps.

Teodor

 

 

 

By: Raj - rajs1

RE: Second Sub report does not show up?

2002-11-17 12:46

Supposing I add a rewind function to the data source, could I call this function within the report (how?).

 

Cheers

-raj

 

 

By: Teodor Danciu - teodord

RE: Second Sub report does not show up?

2002-11-17 12:53

 

Hi,

 

Wouldn't it be simpler to wrap the same data

twice, in the two different instances of your

custom data source class?

 

If not, a call to the rewind method could be made

in a special "dummy" expression, maybe using

a fake subreport parameter.

 

This is only a suggestion. Never tried it.

 

Thank you,

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