2001 JI Open Discussion Posted August 14, 2006 Share Posted August 14, 2006 By: Lenny Ridel - lennyridel sub reports 2002-03-01 05:34Hi Teodor In future directions you mentioned that it is possible to create subreports with current version. Do you have an example? Lenny By: Teodor Danciu - teodord RE: sub reports 2002-03-07 04:28 Hi, This is not easy. I have provided some explanations on a previous thread on this forum, even in a support request. But the main target right now is to introduce sub-reports support for good. Thanks, Teodor By: Lenny Ridel - lennyridel RE: sub reports 2002-03-07 12:59Hi Teodor, I'm trying to do something like this Customer A Product: Sugar Salt Amount: 10 1 Customer B Product: Sugar Milk Honey ... Amount: 2 3 5 Product: AAA BBB CCC Amount: 34 55 66 Custmer C .... Can you advice? Will you support it with subreports By: Teodor Danciu - teodord RE: sub reports 2 2002-03-12 01:05 Hi, Lenny, I have studied your problem a little and I think it can not be solved by sub-reports. Instead, implementing a special data source for you report can solve it. Sub-reports will act just like usual reports. They will generate report sections downwards according to the data source they iterate through and not horizontally. I don't know if in the report structure you presented the number of product name/price is known at design time. If this is the case, and lets say you want to have at most 5 name/price pairs on each customer products row, your problem can be solved with a special designed data source. This data source you have to create has to do at least 2 things: - it has to recognize the moment when the customer changes in the data set; - when the report engine calls its next() method, it has to cache 5 ResultSet rows in one data source row. This means that you have to declare 5 product name fields and 5 product price fields on you report and you have to put them in the corresponding text fields in the detail section (we said that you have 5 name/price column pairs on the detail section). But is up to the data source to transform 5 rows in the ResultSet object in one single data source row with 5 products in it. I can help you create such a data source, but I think you got the idea by now. This data source you will implement can inherit directly from JRResultSetDataSource. Good luck and keep in touch! Teodor By: Lenny Ridel - lennyridel RE: sub reports 2 2002-03-12 09:40Hi Teodor, Thanks for advice. We hoped that subreport will solve the issue. Meanwhilem we choosed the following solution: 1. We defined customer field and N dummy fields. 2. We defined a group for customer. 3. For each customer we create a result of variable length. 4. Each time next is called we check whether more results exists, etc... If you want we can share the code. Lenny 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