I\'m new to JasperReports
. I want to pass ArrayList
to subreport of subreport.
I have master report which contains one subreport1 and this
It's done by passing a collection data-source: new BeanCollectionDataSource(yourArrayList);
And then to obtain the JasperPrint
object:
JasperPrint jasperPrint =
JasperFillManager.fillReport(jasperReport, params, dataSource);
To pass to a subreport, you have two options:
List<Something>
where Something
has a property of type List<AnotherThing>
params
above).Step:1 define a field like
field name="listCusipData" and class="java.util.ArrayList"
Step:2 use this expression inside your sub report dataSourceExpression
new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listCusipData},false)
You can do it using lists and/or subreports, datasources and JRBeanCollectionDatasource.
Check this example:
http://siempredesdeelcurro.blogspot.com.es/2013/06/jasper-reports-crear-report-utilizando.html
It's in Spanish, but by your name I guess you will be able to read it ;)
For non Spanish speakers you still can use it as at the end of the tutorial you can find the XML with the jrxml templates.