2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Cristiano Vasconcelos - cristianov Problem with JRBeanCollectionDataSource 2003-07-30 06:38 Hi :) im having a little problem when i have a master report receiving a JRBeanCollectionDataSource and passing it as $P{REPORT_DATA_SOURCE} to the subreport .. they are both simple plain reports. The master have only a pageHeader and detail where the subreport element is placed, and the subreport have the same bands but in the detail it uses a field $F{Saldo} (that is my field on the bean in the datasource, its numeric double). When in execute everything runs fine but on the final report the first record of the datasource is always skiped! when i use a custom datasource the same thing happens but i?ve captured the call to next() and getField() and i have noted that the first record is there.. but it just dont appear on the report.. i have not found any message on this board that answer this question, but if such message exists please someone show me the link. thanks. By: Teodor Danciu - teodord RE: Problem with JRBeanCollectionDataSource 2003-10-04 13:09 Hi, The first record was skipped because it was consumed by the master detail. This is because you have placed your subreport on the detail band of the master. if a detail is generated in the master it is because it already skipped to the next record and when the subreport takes over it continues with the second record. Passing the REPORT_DATA_SOURCE is not a very good idea as you can see. I suggest you pass the data source as a parameter to the master report. You can even let the master without a data source of its own as long as you place the report on a different section than the detail and use whenNoDataType="AllSectionsNoDetail" for the master. I hope this helps. Teodor Link to comment Share on other sites More sharing options...
kocicn Posted January 11, 2007 Share Posted January 11, 2007 Hi Cristiano, I'am having exactly the same problem as you are, with master report, subreport and custom datasource, so I've been wondering if you have solved it, after Teodor's replay. If you did, could you please let me know how, because even after instructuions that Theodor posted, I still have no first record in my subreport. Actually, I can avoid this problem, by adding the first EMPTY row with no data using my custom datasource, that will be used by master, but I was hoping that you might solve the problem in proper way. My email is nikola@medianis.net Thanks, nikola Link to comment Share on other sites More sharing options...
broschb Posted June 5, 2007 Share Posted June 5, 2007 Not sure it this is too late, but in the Map you pass into your report add another parameter, in this case we'll call it ds. map.put("ds",new JRBeanCollectionDataSource(somelist)); and then create the parameter in your main report called ds and of type JRBeanCollectionDataSource. And use this parameter as your datasource to the subreport. $P{ds} Link to comment Share on other sites More sharing options...
usernamer Posted June 5, 2007 Share Posted June 5, 2007 Hi broschb, can you help me please? http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=26103&catid=9 Or Please! tell me what to input in the "Datasource Expression" subreport field once I get the ${ds} parameter of your solution. Also, ${ds} type is net.sf.jasperreports.engine.data.JRBeanCollectionDataSource? :blush: thanks!!Post edited by: usernamer, at: 2007/06/05 11:43 Link to comment Share on other sites More sharing options...
broschb Posted June 7, 2007 Share Posted June 7, 2007 since you passed a copy of your datasource in as a parameter you can use this as the datasource expression $P{ds} And yes, the parameter ds passed in is of type net.sf.jasperreports.engine.data.JRBeanCollectionDataSource Link to comment Share on other sites More sharing options...
usernamer Posted June 7, 2007 Share Posted June 7, 2007 Thanks for your time, broschb; I have done exactly what you say, but nothing happens. My master report shows OK, but the subreport doesn´t appear in it´s area. It´s very strange because the subreport is printed correctly in an independent file, but it´s blank when included in the master´s printed file. I type the path of the subreport .jasper in the "Subreport (other)" options: and it´s even more curious that only prints the static fields when I put "new JREmptyDataSource()" instead "$P{ds}" (printing the dynamics as null). Do you wonder what it could be? Thank you very much Link to comment Share on other sites More sharing options...
broschb Posted June 8, 2007 Share Posted June 8, 2007 if you post your jrxml, i can have a better idea of what you are doing?, as well as a sample of what your datasource you're passing in is. i.e. what type of objects are in the list, do you have lists of lists? Link to comment Share on other sites More sharing options...
usernamer Posted June 11, 2007 Share Posted June 11, 2007 Hi broschb, thank you very much for your help: finally I got it! :laugh: :laugh: Thank you again because noone else has replied me in any other forum. Bye! Link to comment Share on other sites More sharing options...
usernamer Posted June 11, 2007 Share Posted June 11, 2007 Hi broschb, thank you very much for your help: finally I got it! :laugh: :laugh: Thank you again because noone else has replied me in any other forum. Bye! Link to comment Share on other sites More sharing options...
redwine Posted August 15, 2007 Share Posted August 15, 2007 broschb, I have a question similar the one you replied to recently. It's about using multiple JRBeanDataSource objects to fill a report. You may want to click on the link that follows so you could see my post and maybe shed some light on this matter. http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=29640&catid=8Thanks in advance! edwin Link to comment Share on other sites More sharing options...
marta99 Posted March 5, 2009 Share Posted March 5, 2009 Post Edited by Marta Rivera Sanchez at 03/05/09 18:36 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