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

Custom Field Group refuses to break.

edited March 2004 in General

I'm having a lot of trouble trying to get my groups, based on a custom
field, to break. I have followed the instructions in Tech-Tips and I've done
text searches on this entire newsgroup, yet I haven't found any tip that has
worked.

This is a real simple report. If I can get it to work, I'll apply what I
have learned to a more complex report.

A group header with a static label
The Detail has one database field and one variable
A group footer with a static label

The variable is an integer and the code is simple: Value := Value + 1;

The group is based on the variable.
The group's OnGetBreakValue event says, BreakValue :=
IntToStr(Variable1.Value);

With each transversal, the variable increases. I have done ShowMessage() to
prove it.
OnGetBreakValue is being called successfully and at the appropriate times.
I have done ShowMessage() to prove it.

Yet after the group header prints once, it never prints again, as though the
group change on transversal is not being recognized.

After studying this all day, I'm as perplexed as I can get. Any help would
be appreciated.

-Nathan Seeley

Comments

  • edited March 2004
    Hi Nathan,

    Sorry about the delay in this response... it took a little reasearch to find
    a solution :). Instead of using the TppVariable.OnCalc event, try using the
    DetailBand.BeforeGenerate event. It turns out the OnCalc and GetText events
    fire too late to set the break value of a group. In my test application I
    set the group break value using the groups dialog and added the following
    code to the BeforeGenerate event. This broke a group around every record.
    The reason for the condition inside this event is to ensure the calculation
    is only made once per record. Hope this helps.

    procedure TForm1.ppDetailBand1BeforeGenerate(Sender: TObject);
    var
    lCurrentValue: Integer;
    begin

    lCurrentValue := ppReport1.DataPipeline['CustNo'];

    if FOldValue <> lCurrentValue then
    begin
    ppVariable1.Value := ppVariable1.Value + 1;
    FOldValue := lCurrentValue;
    end;

    end;

    --
    Best Regards,

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