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

How to make Group Header and Footer show dynamically

edited July 2006 in General
Hi,

I have a hierarchical structure. I want the report like this:
----------------------------------------------------------
Income HeaderBand 1
Rent HeaderBand 2
Appartment HeaderBand 3
Ann $400.00
Bob $500.00
Total Apartment $900.00 FooterBand 3
Single Family HeaderBand 3
Charles $1200.00
Dave $1500.00
Total SingeFamliy $2700.00 FooterBand 3
Storage HeaderBand 3
ShortTerm HeaderBand 4
Eric $100.00
Frank $ 80.00
Total ShortTerm $180.00 FooterBand 4
LongTerm HeaderBand 4
Grace $150.00
Hyde $160.00
Total LongTerm $310.00 FooterBand 4
Total Storage $490.00 FooterBand 3
Total Rent $4090.00 FooterBand 2
Gas HeaderBand 2
Jack $150.00
Kim $180.00
Total Gas $330.00 FooterBand 2
Total Income $4420.00 FooterBand 1
----------------------------------------------------------

The structure is a dynamic depth tree. The report is to total each node with
the children's summary.
I already made four groups and ordered them correctly. Now how can I make
the group band show dynamically?

I am using Delphi 6 + RB 9.

Bin

Comments

  • edited July 2006
    Hi Bin,

    It is possible to dynamically toggle the visibility of components located
    inside a band based on where you are in the generation process. For
    instance, if you keep track which group record you are currently accessing
    data from, you can use that information to change the text of a label in the
    HeaderBand 3 from Appartment to Single Family. You could also use that
    information to change how a variable located in FooterBand 3 is calculated.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2006
    Well, that doesn't solve the problem. How about Storage and the children
    under it (ShortTerm and LongTerm). Appartment, SingleFamily and Storage are
    sibling nodes. Short Term and LongTerm are sibling nodes under Storage.
    Toggle label caption from SingleFamily to Storage doesn't create children
    for ShortTerm and LongTerm.

  • edited July 2006
    Or do you think a sample project would be better?
  • edited July 2006
    Hi Bin,

    ReportBuilder does not have any built-in feature to do this type of report.
    All of the sibling nodes would need to dynamically created along with any
    other changing text components. You may want to take a look at the TreeView
    add-on component available from ChoosPill Components at the following page.
    This might give you an easier solution.

    http://www.choosepill.com/components/cpcrbtree.htm

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2006
    Hi, Nico!
    To tell the truth, I already got the four groups show dynamically. I used
    OnGetBreakValue to set the FooterBand and HeaderBand visible/invisible. But
    the problem is for the last record, the OnGetBreakValue doesn't fire. So the
    last FooterBand(s) won't show. The FooterBands contains total amount of
    corresponding accounts. So it is very important to show, especially for the
    last ones.

    BTW, the ChoosPill Components won't help. It doesn't do the summary.

    Bin

  • edited July 2006
    Bin,

    The OnGetBreakValue event will only fire if the group needs to break. Would
    it be possible to use another event in the special case that you are
    printing the last group? If you create a two pass report you can find out
    where that band will be located and you could possibly use the BeforePrint
    event.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.