1

We have 4 list objects as shown below.

List<Discharge> list19a= ddao.getHis(req.getParameter("pid"),"diagnose"); // diag detail, prov diag, dis summ
List<Discharge> list6a = ddao.getPrescription2His(req.getParameter("pid")); //patho inv recomm
List<Discharge> list5a = ddao.getPrescriptionTabHis(req.getParameter("pid")); // prescription, advice
List<Discharge> listfil= dao.getRetrfilesHis(req.getParameter("pid")); // uploaded files

Now we want to pass all these lists to Jasper report. Below is the code where we are using JRDataSource to pass the list. But the below code works fine for only one list, but how to pass all the above lists to Jasper report.

Map<String,Object> parameterMap = new HashMap<String,Object>();
parameterMap.put("realName",realName);

JRDataSource JRdataSource = new JRBeanCollectionDataSource(list19a);
JasperPrint jasperPrint = JasperFillManager.fillReport(report,  parameterMap, JRdataSource);
OutputStream out = response.getOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint,out);

Help Appreciated!

Lmnop
  • 29
  • 8
  • Have you seen this post https://stackoverflow.com/questions/11462311/jasperreports-passing-in-a-list-of-lists-as-a-datasource? I think that they can solve your problem. – Seba López Sep 15 '18 at 11:38
  • Possible duplicate of [JasperReports: is it possible to use multiple data sources, or if not, to use collections in parameters?](https://stackoverflow.com/questions/2425807/jasperreports-is-it-possible-to-use-multiple-data-sources-or-if-not-to-use-co) – Petter Friberg Sep 17 '18 at 08:31

0 Answers0