I looked at alterdesign sample. I don't think I can remove elements from a band using JasperReport object. I couldn't find any API there to help me do so.
 
I think there can be one more approach which may be useful from the maintenance point and without the overhead of compilation process at the runtime. Load JasperDesign object from one design XML and create multiple copies of .jasper file. Just before compilation (which will be one time operation), we can add code to create columns programmatically for each of these .jasper file and then create each of these files on the hard disk. When report generation request comes, appropriate .jasper file can be used to fill the report.
 
Let me know your comments.
Thanks
Ashutosh 
-----Original Message-----
From: Jody Brownell [mailto:jody.brownell@Q1Labs.com]
Sent: Wednesday, March 24, 2004 8:20 PM
To: Ashutosh Gupta; jasperreports-questions
Subject: RE: [jasperreports-questions] dynamic number of columns

I use a combination of subreports and a scriptlet which detects what is in the result set  and removes
the unnecessary columns and laysout the remaining. It works well enough ...  ..... what I sould like to be able
to so is load a jasper XML file into the JasperDesign Objetc set ....then go to fillin and exporting immdediatly
without the compiling. This is turning out to be  abig problem for me ....
 
The best bet, one (which hope to deploy) at a later date is write the application to deal with XML/JasperDesign objects
and compile to jasper files, fill and export as requests are served. I dont like the performance hit of the compilation
however .... too expensive even on a fast machine.
 
I am trying to work with JasperReport object after compilation ... but you cannot modify such things as the height
of bands ... which to me is very important. Changing colors or rows on the fly is dificult unles your XML contains all
the possible combinations a head of time.
 
There needs to be a way to load an XML file as  A Jasper Design and and print / export directly without the 
intermediate compilation step. Right now if I take a Jasper Design direct to Fill I fail to load the Calculater or
something ... and then I have no Compile data with the report ... I am a little new with jasper, so I am not sure why
they are required
 
If you are loading your report with JRLoader ... it may simplfy or clean up your XML if you remove the columns you dont need
from a report programmaticaly ... this is fairly straight forward. Take a look at the laterdesign to get started.
 
good luck
 
-----Original Message-----
From: Ashutosh Gupta [mailto:ashugupta@eGain.com]
Sent: Wednesday, March 24, 2004 1:57 AM
To: Jody Brownell; jasperreports-questions
Subject: RE: [jasperreports-questions] dynamic number of columns

I am dealing with JRReport. A user can have 1 to 12 columns in the report. What I am thinking is overlapping sub-reports for for each number of columns and use prinwhenexpression to display these subreports. So, number of columns will decide which subreport will be printed. But then, I will have to maintain 12 extra XML design files for this report.
Yes, seems to be doable for me also but I was hoping for a clearer solution.
Thanks
Ashutosh
 
-----Original Message-----
From: Jody Brownell [mailto:jody.brownell@Q1Labs.com]
Sent: Wednesday, March 24, 2004 10:19 AM
To: Ashutosh Gupta
Subject: RE: [jasperreports-questions] dynamic number of columns

I am doing this right now :) hehehe not very fun .... it is doable but feels rather hacky ....
are you dealing with e JasperDesign objetc or a JRReport?
-----Original Message-----
From: jasperreports-questions-admin@lists.sourceforge.net [mailto:jasperreports-questions-admin@lists.sourceforge.net] On Behalf Of Ashutosh Gupta
Sent: Wednesday, March 24, 2004 12:48 AM
To: jasperreports-questions
Subject: [jasperreports-questions] dynamic number of columns

Hi,
        I have a report which has dynamic number of columns and report decide at run time how many columns will be shown. Also, width of these columns should be adjusted according to the number of columns displayed in order to fill whole page width.

Has anybody tried this before? Any help would be greatly appreciated.
Thanks
Ashutosh