How to dynamically add multiple pieces of data in Jasper Reports

JasonkeRider

New Member
I have a Jasper Report I am working on in Java. In Java I can dynamically populate a bean with data with the following code:\[code\] List<ThemeBean> themes = new ArrayList<ThemeBean>(); CSVReader csvReader = new CSVReader(new FileReader(csvFilename)); List<String[]> data = http://stackoverflow.com/questions/15534664/csvReader.readAll(); for(String[] d : data) { ThemeBean tb = new ThemeBean(); tb.setThemes(d[0]); tb.setComments(d[1]); tb.setSentiment(d[2]); themes.add(tb); } JasperDesign jasperDesign = JRXmlLoader.load(fileName); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(themes); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, ds);\[/code\]This works well when the .jrxml file has the correct fields specified and textFieldExpression within the tags... The following gets dynamically populated with the List that was built:\[code\]<textFieldExpression><![CDATA[$F{themes}]]></textFieldExpression>\[/code\]My problem is figuring out how to do this Dynamically for two different data sets in the same report. It seems that I can only use for one List of data to be dynamically added. If this question isn't clear, please let me know and I will attempt to fix it. Thanks.
 
Back
Top