atmaling Posted October 29, 2009 Share Posted October 29, 2009 Hi , I am new in Ireport I made one report which have JavaBean Datasource connection now I want to add this report as a subreport into another report which may have different connection . I made that and write conection expression is P!{Report connection} it runs fine but data is not display.Please help me how to solve that problem Please it is urgent for me Thanking You Atmaling Link to comment Share on other sites More sharing options...
giobby Posted October 30, 2009 Share Posted October 30, 2009 Hi,I'm not properly able with english...My english is too scholastic , my iReport version is old (2.0) and also in Italian language...Anyway I try to help you... I met in this period your same issue and i solved with theese following steps.First of all we have to know that datasources are "consumable" objects, so we can use them only once a time.This is important ,for example,when we must to print multiple report in different formats.I think that your problem depends by this matter, but I'm a newbe and I'm not sure.1- I have set theese subrpt properties (in the main rpt => rightclick on subrpt icon):"new JRBeanCollectionDataSource($F{fieldSubDataSource})" => Expression of data source (nb: note that is not a param, is a field). "net.sf.jasperreports.engine.JasperReport" => Class of SubReport.$P{<nameOfYourSubRptJasper>} => Expression of your subRpt passed like a param. 2- I have declared in my JavaBean another attribute called "private Collection fieldSubDataSource" (with naturally get and set methods).3- in the main rpt i have added a field (called fieldSubDataSource with type java.util.Collection) that I have set in my java app with a Collection object (that returned an array list containing the resulset that represents my subrpt data source) when i have filled all the other main rpt fields trough the resultset.Resume:In this way i've passed the subrpt like a param and the subrpt data source like a field of the main rpt and all works perfectly.hope to help you bye. Giovanni...La puissance est rien sans controle... Post Edited by giobby at 10/30/2009 11:43 Link to comment Share on other sites More sharing options...
giobby Posted October 30, 2009 Share Posted October 30, 2009 ...and if you want to learn more see theese topics:1- http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=123172- http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=15193 byeGiovanni ...La puissance est rien sans controle... Post Edited by giobby at 10/30/2009 16:19 Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted November 2, 2009 Share Posted November 2, 2009 Anyone willing to write a tutorial about using javabeans with subreports to be published on the new iReport site?It would be really appreciated!In interested, contact me giulio [at] jaspersoft.com.Thanks a lotGiulio Link to comment Share on other sites More sharing options...
Timbo2013 Posted August 20, 2013 Share Posted August 20, 2013 I was trying to fill my reports with map AND bean all over the time --> no success! But with the "trick" to add the bean to the hashmap it worked straightaway =) Link to comment Share on other sites More sharing options...
Timbo2013 Posted August 20, 2013 Share Posted August 20, 2013 I did it^^ Filling a report with hashmap "and bean" - though the bean has been added to the hashmap: yes: [...].fillReport(report, hashMap, new JREmptyDataSource()); no: [...].fillReport(report, hashMap, beanDataSource); I'll write down my experiences for me and if a tutorial is still wanted I could try to translate it (from German to English^^)...!? 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