Dynamic number of columns

By: Oliver Toma - olivertoma
Dynamic number of columns
2003-07-22 03:41
Hi forum,

how can i manage a dynamic number of columns? on the client side you have the ability to show/hide columns. how can i design the report due to that problem? do i have do know in advance (means at designing time) which columns should be printed?


By: Ryan Johnson - delscovich
RE: Dynamic number of columns
2003-07-22 09:43
Do you care whether there's empty space? It's possible to hide columns. If there are only going to be a couple of variations, you could use <printWhen> to control which ones show.

Could you be more specific about what you're trying to do?


By: Oliver Toma - olivertoma
RE: Dynamic number of columns
2003-07-23 06:20
Hi Ryan,

sound good. I have an applet context with data supplied by a cobol host. in the applets there are tables, which can be influenced by the user. means that columns can be hided/shown (via right mouse-click).
there are only a few variations, so that your model might work, but will the empty space be reduced, or will there be a big gap between two "table-cells"?


By: Teodor Danciu - teodord
RE: Dynamic number of columns
2003-07-23 06:29


I think the best way is to have some default report
templates stored in XML form and to let the user
alter them at runtime by hidding and moving columns
Changing the position of elements (columns) in a band
implies report design recompilation (revalidation).

But I think a better approach is to let users define and store their own report templates derived from
the default ones.
They will reuse those custom templates and will
not be forced to specify the columns every time
they want to run the report. Instead, they could
chose a previously defined template that is already
in a compiled form.
Performance will be much better if they don't have
to recompile the report designs with every execution.

I hope this helps.

By: Ryan Johnson - delscovich
RE: Dynamic number of columns
2003-07-23 18:30
Teodor is right - it is cleanest to use different templates for each variation.

However, if you really want, you can use <printWhen> and parameters to show/hide columns in different places and of different sizes. Depending on how complicated you make things, you may or may not leave empty space between hidden columns.

It would also depend on whether you have control over your JRDatasource from the program or if it comes straight from a ResultSet.

I'd go with Teodor's way, myself
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 10 months ago

0 Answers:

No answers yet