chrisrollins65 Posted July 15, 2015 Share Posted July 15, 2015 I'm new to Jaspersoft Studio, so I'd like to know if it's possible to do the following:The problemFor my report in Jaspersoft Studio, I'm passing in parameters from a java class, and one of the parameters is an ArrayList that contains information such as this:ArrayList<String> benefits = new ArrayList<String>();benefits.add("benefit_1");benefits.add("benefit_2");benefits.add("benefit_3");benefits.add("benefit_4");In my report, I need to display the information like this:- Benefit: benefit_1- Benefit: benefit_2- Benefit: benefit_3- Benefit: benefit_4This ArrayList has a variable amount of items, so sometimes there are 4, sometimes only 2, etc.How can I iterate through this list in the report and output it in this format?What I've triedFrom reading other similar questions here and on stackoverflow, I've tried adding a subreport with the ArrayList as the data source:<subreport> <reportElement ... /> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{benefits})]]></dataSourceExpression> <subreportExpression><![CDATA["benefits.jasper"]]></subreportExpression></subreport>[/code]But in the subreport, how would I display the ArrayList elements?Or is it possible to do what I'm trying to do without the subreport? Link to comment Share on other sites More sharing options...
chrisrollins65 Posted July 16, 2015 Author Share Posted July 16, 2015 Well if anyone runs into a similar situation, I've posted a solution at http://stackoverflow.com/a/31447848/1193304 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now