View Full Version : Report with more than one table

02-13-2005, 08:47 AM
First sorry if this questin is already here, but I can't find this here and in google.

I have a class that represent a Project, and this project has a lot of atributes like name, date of begin, date of finish, and some of tables like list of people that work on this, list of activities... And I have to print all of information of this project in one report.

It's some think like "report3.xml" in JFreeReport demo, but I have more than one lists (tables) to print in the same report. A solution that I'm working is to make more than one report to show ant print to user in a unique swing frame, but I'm having problems with number of pages and some times if I'd like to put two list in one page.

Some body have any ideia to give me?

Thanks for any comments.

02-14-2005, 02:01 PM
Trust me for some reason. ether this question is to dumb to be answered, or it was answered so many times that nobody is going to bother to answer, or everyone is to ashamed to answer it because JFreeReport simply does not handle this sort of problem. Check out my past 2 posts. it circles around the same problem and guess what apparently nobody has a single opinion about it.

02-14-2005, 05:38 PM
Hi all, searching more about this I found a post here that was something like my question:


I haven't time to try but a looked at conditional group demo and appears that is exactly what I'm looking for, mjreged may this resolv your problem too.


02-15-2005, 06:59 AM

. and sometimes silence just means that it is weekend and noone listened :)

JFreeReport does not support more than one datasource (yet). So for now, the solution is (as you found out) to union all tablemodels into one large model and to use the same solution as given in the conditional groups demo.

@mjreged: Sometimes, when the cold and icy world outside puts some pressure on me, be it exams or plain working for food and rent, posts might remain unanswered. If you suspect that, reply to your post with a reminder for me so that it moves up to the top again and will not be forgotten.

Have mo' fun,
said Thomas

02-15-2005, 11:27 AM
I am sorry if i sounded disgraceful, i really did not mean to disrespect, i truly admire the open source mentality. I only need you to know that the criticisms was really directed at myself for being unable to find an solution to my first post. A fear per say of the fact that perhaps this question is indeed not worth even explaining it after all, i am sure this is a classic example novice user who trips over the first fundamental obstacle in modeling report using JfreeReport. Furthermore I surely did not expect one of the leaders of the project to actually act on my post due to the fact that there is few of you and many of us. I felt that this project being open-source surely has many followers and experienced users, and hoped for those kind of people to perhaps share their experience and solutions to common report design. On that note, i thank you for your time and devotion, I feel that as soon as i become a more advanced user, i am hoping to look under the hood of your project and contribute in near future. I admire the freedom this Report provides, thanks to the TableModel interface, and the ease of drawing Graphics on reports. I have written few custom functions taken example from the standard function i could not believe how much of control it provides. I have used Cristal Reports in the past and i must tell you that except for the easy visual builder they provide, your JfreeReport is show really promising potential. Even JasperReport i found harder to use.

Ohh Yeah and guess what i just realized i posted my question in the wrong category, I misplaced my posts in JFreeChart section, my apologies

02-15-2005, 11:47 AM
Just Restating the Problem, No need to reply since i am sure that the solution is provided within the conditional groups demo

This Proposal object holds three Vectors of information
1.Work Scope vector.( kinds of work to perform ex: Roofing )
2.Subcontractors vector. ( subs who will work on this project as well )
3.Work Force vector. ( kind of employees needed for the project )

The WorkScope vector holds
Vector Tasks ( task that need to be done for each Scope ) which holds
Vector Materials ( hold descr, cost, qty, units )
and Vector Workers

So as you can see the Proposal Object in turn holds many inner Vectors of information that need to be drilled down.

I tried ResultSet from database, however it is impossible to create a single query (no matter how complicated ) to have table that would correctly represent all the aspects of the details. For example. I cannot merge tables that hold material and Workers under the task because the material table is of different size from worker so i get loop repeats of worker table. If i throw in the subcontractors it gets worse. So i would need to fetch multiple tables and pass to JFreeReport. ( i guess ) But i know that's impossible with JFreeReport right now.

I am trying to build CustomTableModel but i am not sure how JFreeReport parses through the tableModel, i ran console row , col printing as it reads the getValueAt(int , int) method and at first glance did not go as i thought it would.

I just cannot see or come up with a way to wrap my Proposal Object around TableModel and have the JFree Report run through 3 different branches of information in which each of them have multiple groups that need to be displayed . Is there a post that talks about the detail how TableModel gets parsed as the report progresses with the creation of the report ?

02-15-2005, 06:15 PM

just to resolve some confusion:

I am trying to build CustomTableModel but i am not sure how JFreeReport parses through the tableModel, i ran console row , col printing as it reads the getValueAt(int , int) method and at first glance did not go as i thought it would.

JFreeReport scans the complete table model, from the first row to the last (in that order, although it might look different from the debug outputs, but that's just how JFR handles the repagination later in the report processing. Just assume that JFR scans from the first to the last row, this is how an observer from inside the report definition object would see it).

For every row in the tablemodel, an itemband is printed; group headers and footers are inserted whenever necessary. The used base algorithm is known as 'control break' algorithm; most Cobol and RPG/400 programmers will know that thing. For all other programmers, a description can be found at http://www.tsufl.edu/dmemory/ctlbrk2.htm.

Have mo' fun,
said Thomas

Btw.: After searching for the text of your posting, I saw that it was posted into the JFreeChart forum. I do not monitor that forum very closely, handling JFreeReport's support and development is enough for me :)