Re: [jasperreports-questions] Multiple Object in DataSource Collection
private JRBeanCollectionDataSource dataSource; private MapString, Object parameters = new HashMapString, Object(); CollectionReportBean BeanList = createBeans(); dataSource = new JRBeanCollectionDataSource(BeanList); //use parameters if the value doesn't change i.e.customer name,account number,etc. parameters.put(PROJECT_ID, project.projectID); CollectionReportBeans createBeans(resultSet){ ListReportBeanList result = new ArrayListReportBeanList(); foreach (value in the resultSet ) { ResultsReportBean Bean = new ResultsReportBean(); Bean.setType(Project); //i.e. prjoect or coverage Bean.setId(Id); etc, etc, etc } result.addAll(Bean); JasperReport jasperReport = JasperCompileManager.compileReport(templateFilename); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters , dataSource); JasperExportManager.exportReportToPdfFile(jasperPrint, reportFilename); Thank you very much for your reply. I dont expect spoon feeding. I try to kick start with the piece of code that you provided. -- View this message in context: http://www.nabble.com/Multiple-Object-in-DataSource-Collection-tp25816344p25837848.html Sent from the jasperreports-questions mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
Re: [jasperreports-questions] Multiple Object in DataSource Collection
Novice requires some more clarifications. Having Chris's Idea running in parallel. I would like put my question in a different way. In JRXML field name = projectId class = java.lang.Integer field name = coverageId class = java.lang.Integer Is there any way that i can mention projectId belongs to the class Project coverageId belongs to the class Coverage ?? -- View this message in context: http://www.nabble.com/Multiple-Object-in-DataSource-Collection-tp25816344p25840895.html Sent from the jasperreports-questions mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
[jasperreports-questions] Multiple Object in DataSource Collection
Hello All, I need to use two objects for generating reports with JRXML dataCollection.add(project); dataCollection.add(coverage) I use JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(dataCollection); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds); this works fine when i use only one object. Say Project. If i use two objects. I get error in the JRXML (As field not found) How to solve this problem. I need to get values from both the objects Some help will be declared great -- View this message in context: http://www.nabble.com/Multiple-Object-in-DataSource-Collection-tp25816344p25816344.html Sent from the jasperreports-questions mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
Re: [jasperreports-questions] Multiple Object in DataSource Collection
Without knowing much about your code or system I would say you need a subreport to use 2 datasources. However if the data you need is in 2 separate databases then why not use a join sql statement? The Query is session.createQuery(from jasperReport.Project P,jasperReport.Coverage C where P.projectId = 1 and C.coverageId = 1) Corresponding SQL Query:select project0_.PROJECT_ID as PROJECT1_1_0_, coverage1_.COVERAGE_ID as COVERAGE1_0_1_, project0_.PROJECT_NAME as PROJECT2_1_0_, coverage1_.COVERAGE_NAME as COVERAGE2_0_1_ from PROJECT project0_, COVERAGE coverage1_ where project0_.PROJECT_ID=1 and coverage1_.COVERAGE_ID=1 This returns two objects. Project and Coverage. Project Attributes: projectId projectName Coverage Attributes: coverageId coverageName projectFk(Foreign key - project.projectId) Now in the JRXML field name = projectId ... is accepted field name = coverageId... is showing error as undefined property Is there any wat to call the attributes separately like project.ProjectId coverage.coverageId?? -- View this message in context: http://www.nabble.com/Multiple-Object-in-DataSource-Collection-tp25816344p25818786.html Sent from the jasperreports-questions mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ jasperreports-questions mailing list jasperreports-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jasperreports-questions