pintusingha Posted January 18, 2010 Share Posted January 18, 2010 Hi,I am using i-report 3.7.0.I am using javabeans datasource connection.My bean looks as follws:package org.springframework.samples.jasperdemo.web;import java.util.ArrayList;import java.util.Collection;import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;public class ChartBean { private Integer month; private Integer year; private Integer orders; public Integer getMonth() { return month; } public void setMonth(Integer month) { this.month = month; } public Integer getYear() { return year; } public void setYear(Integer year) { this.year = year; } public Integer getOrders() { return orders; } public void setOrders(Integer orders) { this.orders = orders; } public JRBeanCollectionDataSource createMyDataSource() { JRBeanCollectionDataSource jRBeanCollectionDataSource = new JRBeanCollectionDataSource(ChartBean.createMyCollection()); return jRBeanCollectionDataSource; } public static Collection createMyCollection() { ArrayList beans = new ArrayList(); for (int x = 0; x < 5; x++) { ChartBean bean = new ChartBean(); bean.setMonth(x); bean.setYear(x); bean.setOrders((x*2)); beans.add(bean); } return beans; }}In the main report my subreport properties are set as:<subreport runToBottom="false"> <reportElement x="42" y="30" width="200" height="14"/> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA["report1_subreport1.jasper"]]></subreportExpression> </subreport>I am feeding this bean to my subreport and while previewing the subreport itself i have been able to get the output as attached below "subreport.doc".But while i run the report from the master report i get the same output but the first row is knocked out as shown in the attached file "mainreport.doc".I cant guess why its knocked off.Iam not quite sure about the "datasource expression" which i am using while creating the subreport wizard.Can anyone please guide how to link a subreport in my set example.My basic requirement is to keep this bean in the subreport and try to execute from the master report. 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