Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

Columns in a column?

edited May 2004 in RAP
Hello again,

In my report I have 2 -main- columns. I'd like additional data to be
displayed in 3 columns in every main column. Can this be done? And if yes,
how?

I am currently looking at using a ppCrossTab instead but I can't get it to
work. I have to build the whole crosstab on runtime and this is what I do:

ppCrossTab1.InitAvailableDimensions;
Index := ppCrossTab1.IndexOfAvailableDimension('OPTNAAM');
if Index > -1 then
begin
ColumnDef := ppCrossTab1.SelectColumnDef(Index);
ColumnDef.Color := clRed;
ValueDef := ppCrossTab1.SelectValueDef(Index-1);
end;
Index := ppCrossTab1.IndexOfAvailableDimension('OPTWAARDE');
if Index > -1 then
begin
ColumnDef := ppCrossTab1.SelectColumnDef(Index);
ValueDef := ppCrossTab1.SelectValueDef(Index-1);
end;
Index := ppCrossTab1.IndexOfAvailableDimension('OPTEENHEID');
if Index > -1 then
begin
ColumnDef := ppCrossTab1.SelectColumnDef(Index);
ValueDef := ppCrossTab1.SelectValueDef(Index-1);
end;

You might be curious why the Index for the values is done -1. Well, without
it it would give me an Index Out Of Bounds error on the last SelectValue...
Weird. But anyway,

When I run my report I can see that the used dataset that is connected to
the ppCrossTab1.DataPipeline has 3 records but I do not see any crosstab..

Any ideas on why this is the case? Should I use a crosstab for this at all?
The crosstab only has columns with data and doesn't need any rowheaders.

Thanks for reading sofar,

Vincent.

Comments

  • edited May 2004
    Maybe I should write this a bit more clear:


    There are 3 recordsets, X, Y and Z. X is the master and Y and Z are details.
    My other post was about recordset Y which is connected to the TppReport so
    that Y's contents can be displayed in columns (ctLeftToRight).

    So if Y holds 3 records the report will have 3 columns.

    Recordset Z however can have several records per record in Y. Those records
    I'd like to have displayed in the same column but then using ctTopToBottom.

    Example: A person (X) has 4 houses (Y) and the rooms of those houses are
    rented out to 20 people (Z).

    The report should print:
    - A header with details about the owner of the houses (X)
    - 1 column for every house with details about the house (Y)
    - Every column should state the names of the persons renting a room (Y)

    Can this be done and how?

    Thank you very much for any help you could give!

    Regards,

    Vincent.
  • edited May 2004

    A crosstab is useful if you have some data to summarize into various row and
    column dimensions.

    Note sure whether that is what you need here. As a test, try creating the
    crosstab using the crosstab designer. You can always re-implement as a code
    based solution later.


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004

    I assume that the data is linked in a master/detail relationship.

    You could try using a subreport to traverse Z and list the records for Z
    that are related to each Y.



    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    Hi Nard,

    The number of records in Z varies so I can't use a fixed number of fields in
    a subreport. How do I make a subreport auto-create the neccesary fields
    then? Or can you make 1 subreport and repeat it for each record in Z?

    Cheers,

    Vincent.

  • edited May 2004

    Place the subreport in the detail band of the report that is connected Y.
    The subreport will generate once for each record in Y. Connect the
    subreport.DataPipeline to Z and it will generate one detail band for each
    record in Z (i.e. each record in Z that is related to Y, if the data is
    properly linked).

    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    I did what you said but it's not working. I read in the help that a detail
    will not print if the parent band's Printheight is set to Static. Since I'm
    using columns that go from left to right instead of toptobottom I cannot set
    the printheight to dynamic and thus the subreport doesn't print.... I tried
    to set the column to toptobottom so that I could change printheight to
    dynamic and I saw more data apearing but my report looked bad then...

    Any suggestions?

    Vincent.



  • edited May 2004
    I meant subreport instead of "detail" in my first line... sorry.

    V.

  • edited May 2004

    The LeftToRight column traversal feature is very limited. Since the band
    must be static height, you would have to use a subreport set to pbFixed and
    size the width and height of the subreport to act as fixed size boundary.

    If you cannot use a fixed size subreport, then you will have to use a
    different approach. One option would be to use top to bottom columns and
    define a group that breaks for each master record and starts a new column.


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    I indeed found a different approach and am happy to tell you that I got all
    reports fully functional again right before the weekend so I'm pretty
    satisfied with that :-)

    Thanks for your help and hope you have a nice weekend,

    Vincent.

  • edited May 2004

    Congrats. :)

    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.