Jump to content
Changes to the Jaspersoft community edition download ×

Problem with same Subreport Multiple times


Recommended Posts

By: Ashish - ashisharte

Problem with same Subreport Multiple times

2004-01-02 15:43

Hello All,

 

I am having difficulty producing a report which has a same subreport appearing multiple times.

 

For instance Master Report A has subreport B in its columnfooter and the same subreport B in page footer. ( I have to do so that I can send my client one section of the report and I can keep the other one for my records ).

 

I implemented this by storing the subreport's data ( from a custom datasource that implements all the methods properly) in a hashmap ( SubReportDataSrc ) so that at runtime it is populated according to the master report's id.

I was expecting Jasper to populate both subreports ( since they are identical and have the same data source), but it appears to populate only one subreport while the other one is empty ( it gets an empty data source, since the subreports other sections do print ).

 

The subreport section of the columnfooter looks like this:

 

....

....

 

<dataSourceExpression>

<![CDATA[(dori.jasper.engine.JRDataSource)$P{SubReportDataSrc}.get( $F{reportid} )]]>

</dataSourceExpression>

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

<![CDATA[$P{SUB_REPORT}]]>

</subreportExpression>

...

...

 

And that of the page footer which is identical looks like this :

 

...

....

 

<dataSourceExpression>

<![CDATA[(dori.jasper.engine.JRDataSource)$P{SubReportDataSrc}.get( $F{reportid} )]]>

</dataSourceExpression>

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

<![CDATA[$P{SUB_REPORT}]]>

</subreportExpression>

...

...

 

Dear Teodord , any pointers on what I am doing wrong ?

 

Sincerely

Ashish

 

 

 

 

 

By: Vinod Kumar Singh - vinodsingh

RE: Problem with same Subreport Multiple time

2004-01-03 03:34

After printing the sub-report first time cursor goes beyond the last row that is why no records are printed second time. You have to rewind the result set before calling the sub-report second time.

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