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

Dynamically creating group header and footer bands

edited June 2009 in Datapipelines
Hi all,

I have a Delphi 2007 datamodule containing two tables. One with detail info
(DetailID, Data, DeepestgroupID) and one with hierarchal group info (groupid,
DetailID of start of group, Detailid of end of group).
I want to show the group headers, detaildata en groupfooters in a report
in a hierarchal way, with the possibility to have data on all levels.

So a possible output could be:

header10
+detail0
+header20
++detail1
++detail2
+footer20
+detail3
footer10

So one of the major things i need to change is the ability to print a header
without the footer of the preceding group, and the other way 'round.

I'v started with creating my own DBPipeline which delivers all header, footer
and detail data sequentially, with an added calculated field 'CURRENTRECORDTYPE'.

So in the previous example this would become:

GroupHeader id=10
Detail data=detail0
Groupheader id=20
Detail data=detail1
Detail data=detail2
Groupfooter id=20
Detail data=detail3
GroupFooter id=10

Now i'm kinda stuck creating a report that will show this the correct way.

I tried using a group with a cutom break field that would never break on
its own, and set the Generation property of the groupheader and footer according
to the value of the CurrentRecordtype and then call Generate of that band.
But this doesnt work. It skips the footer or header on some occasions (and
i havent figured out why)

Does anybody have any idea on how to handle this?

thanks
Bas Schouten

Comments

  • edited June 2009
    Hi Bas,

    Where are you assigning the group break value. This needs to be done in the
    Group.OnGetBreakValue event. Rather than manually trying to generate each
    band, try letting the group handle it.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2009
    Hello Nico,

    I did try that road .. but the problem is that i dont want to print a footer
    every time a new group starts, because the group can be hierarchally deeper,
    and the footer has to be printed when traveling a level upwards

    You have a suggestion to tackle that?

    gr
    Bas
  • edited July 2009
    Hi Bas,

    It is always possible to simply hide the band you do not want to display by
    setting it's visible property to False. You could set up a flag field that
    determines when a certain group's header and footer bands are allowed to
    print, otherwise they are invisible.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2009
    Hello Nico,

    thanks for the tips, but i think that won't work. I do want every group to
    have a groupheader and footer printed, but they should print
    on a different location in the report.

    I want it to look like this:
    header10
    +detail0
    +header20
    ++detail1
    ++detail2
    +footer20
    +detail3
    footer10

    while rb standard would create it like this:

    header10
    +detail0
    footer10
    header20
    +detail1
    +detail2
    Footer20
This discussion has been closed.