blaguman Posted May 13, 2009 Share Posted May 13, 2009 Hello ! I have a big problem for around a week, and I really don't understand how to solve this ! I have a subreport in my main report, and in this subreport, there is several levels of subreports. I have indeed several frames one below the others (there's a loop on the datasource).In the example I'm working on, I have 3 frames. In the main report, the band containing the subreport element is set to "splitAllowed", 'cause I'd like my frames to be printed on several pages. In my example, all my frames and their content (including the fields from the datasources) displays very well. BUT, if I add some text in the above bands, everything starts to be confusing.My third frame goes to the next page, as wanted (that is correct), but the data it should be containing doesn't appear anymore...If I add some text above, the second frame goes to the next page with the third, and both are displayed very well..I really do not understand where it comes from, and what I should do...I join three screenshots, so you can understand a little better. The result is really unpredictable... Please, help meeee :'(:P Thank you very much for your help ! Best regards,MorganPost Edited by blaguman at 05/19/2009 08:32 Link to comment Share on other sites More sharing options...
blaguman Posted May 18, 2009 Author Share Posted May 18, 2009 Hello ! Nobody tried to answer this post ? :(Does someone already have faced this problem ?Thank you... Morgan Link to comment Share on other sites More sharing options...
blaguman Posted May 19, 2009 Author Share Posted May 19, 2009 If you want some extra information, after several tests, I've seen that in every case, my DataSource is not null (I write something like ((JRBeanCollectionDataSource)($P{REPORT_DATA_SOURCE})).getData().toArray()[0], and I have the values contained in my datasource.It's just the field mapping that doesn't work, and I really don't understand why...Could it be linked to the location of the frame (the "header" of the second page) ? Thank you... Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 27, 2009 Share Posted May 27, 2009 Hi, I think we need to see the JRXML and understand what data source you pass to the subreport. Even if the data source is not null, its current record pointer might be moved and thus some records get skipped.It is a bad idea to pass the master report data source to one of its subreports. YOu should not pass the REPORT_DATA_SOURCE parameter to subreports, because both the master and the subreport will make the current record pointer move and records get skipped. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
blaguman Posted May 27, 2009 Author Share Posted May 27, 2009 Hi Theodor, and thank you very much for your response ! First of all, I never pass the REPORT_DATA_SOURCE element as the subreport's DataSource expression, 'cause I've of course understood that the first record might be consumed (which is perfectly logic, BTW, well done !).But the cursor of the DataSource may indeed not be pointing to the first record... I've seen a JRBeanCollectionDataSource element dispose of a function called moveFirst(), which would be interesting to try. But can I make a call to this function in the JRXML file (from iReport) ? I've build a small "architecture" of my subreports, which I join to the jrxmls, so you can better understand how my subreports work... Thank you VERY MUCH again, you're really nice having answered ! Link to comment Share on other sites More sharing options...
blaguman Posted May 27, 2009 Author Share Posted May 27, 2009 I was limited on file attachments, here are the last jrxml files... Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 27, 2009 Share Posted May 27, 2009 Hi, If it is about JRBeanCollectionDataSource, then you should not be passing the exact same instance to the two subreports, but rather recreate a data source instante with new and by wrapping the same collection.This way you'd be seding the same data, but the record pointer would be at the begining of the collection, each time. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
blaguman Posted May 27, 2009 Author Share Posted May 27, 2009 Teodord...THANK YOU ! It works ! I really don't understand how it could be this unpredictable (most of the time, the cursor spotted the first record), but it's now OK ! Thank you again, and see you soon ! Morgan 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