Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport with only one row printed


gioacchinomauri

Recommended Posts

Hi all,

 

I'm using jasper reports and iReport 2.0.2. I have a "master" report with a subreport and i'm using a javabean datasource for filling them. When i try to execute the generation of the pdf i obtain only one row in the detail section (represented by the subreport). I'm feeling i've got something simple missing but i don't know what.

 

I've selected "print repeated values" checkbox in subreport element and textfield elements in the subreport itself.

 

The row printed is the "last" of the collection of elements passed to the report.

 

In the subreport i defined "$P{REPORT_PARAMETERS_MAP}" on "Parameters map expression" and $P{REPORT_DATA_SOURCE} on connection data source because i want to use the same datasource in master and detail report.

 

I attach the jrxml of either the file, the master is "ordini.jrxml", the detail is in "ordini_dettaglio.jrxml".

 

Thanks to all [file name=reports-3526222b9a3d299841eddd382e21bbc9.zip size=2977]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/reports-3526222b9a3d299841eddd382e21bbc9.zip[/file]

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

 

No, you don't want your subreport to use the same data source as the master report. Read this FAQ here:

http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/jasperreports/faq.html#FAQ20

 

Also, passing the REPORT_PARAMETERS_MAP instance to the subreport is discouraged, as the subreport will alter it, with unexpected consequences. When passing this map to the subreport, make sure you wrap it in a new Map instance, like this:

 

new HashMap($P{REPORT_PARAMETERS_MAP})

 

I hope this helps.

Teodor

Link to comment
Share on other sites

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