Jasper report iterates over array list

how can I create a report that will iterate over the arraylist section in a detailed section that is passed as a parameter in a Jasper report?

Is it possible? I searched and I found a solution that you should add an ArrayList as a data source. How to do it?

Hi

+6
source share
1 answer

You can create a SubReport to pass an ArrayList as an expression of a DataSourceExpression:

<subreport> ... <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{arrayList})]]></dataSourceExpression> <subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression> </subreport> 

Javadoc:

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/data/JRBeanCollectionDataSource.html

+4
source

Source: https://habr.com/ru/post/900618/


All Articles