Home General

Change group header field by code

Hello,
Depending on the user selections in the Delphi dialog, I would like to change the data field on which the group shown in the group header breaks. I tried mainly in the Report BeforePrint.
I thought maybe set up two GroupHeaders, Groups[0] and Groups[1] and tried a few things, like:

ppReport1.GroupHeaderBand[0]:= Active;
ppReport1.GroupHeaderBand[1]:= Active;

ppReport1.Groups[0].FieldName:= 'Diagnosis';

and so forth.

Scott S.

Comments

  • Hi Scott,

    Unless you have a need for nested groups, I would avoid using multiple groups inside the report.

    If you are simply looking to alter the breaking field of a single group, I suggest assigning the Group.BreakName property before the call to Report.Print. You will need to make sure your data is sorted by the new breaking field for the report to group logically.

    Another option would be to create two subreports (each with a different group) and toggle the visibility of each subreport based on the user selection.

    Yet another option (from our previous conversation) would be to create two separate reports or templates that are loaded/printed based on the user selection.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Thanks much, Nico. It looks like the BreakName property will work for this!
    Scott
Sign In or Register to comment.