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

Removing Groups & their headers and footers in code

edited December 2013 in General
Hi,

I've written a class that takes an object list and automatically generates a
Report Builder report based on the contents. You can also add groups and
respective headers and footers. So you can write code like this :-

MyReporter.ObjectList := CustomerList;
MyReporter.AddGroupField('Area', True, True); // Parameters are fieldname,
create group header band, create group footerband
MyReporter.SetupReport;
ShowReport(MyReporter.Report);

The problem is repeated calls to this routine cause an extra group header
and footer to be generated as I can't find a way of removing them in code. I
see there's a GroupCount property, and Groups, GroupHeaderBand and
GroupFooter bands, but I can't see how to remove them. I'd expect to be able
to do something like this :-

For I := Pred(FReport.GroupHeaderBand.Count) DownTo 0 Do
FReport.GroupHeaderBand.Delete;

But it doesn't appear as though this functionality is supported. Anyone have
any ideas? This is ReportBuilder 10 under Delphi 7 (legacy project that will
soon be upgrading to XE5 and RB15).

Thanks in advance,

Andy

Comments

  • edited December 2013
    Hi Andy,

    When you create a group, the group header and group footer are
    automatically created by design and define the start and stop of the
    group itself.

    It is not possible to simply remove the group header and footer bands
    without removing the entire group itself. You can however toggle the
    visibility of the GroupHeader band and GroupFooter band if you would
    like to hide them

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2013
    Hi Nico,

    Thanks for the reply. It's not a problem to remove the groups and I've just
    checked that removing the groups, does indeed remove the group header and
    footer bands.

    Thanks again.

    Best regards,

    Andy
This discussion has been closed.