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

Ref.: ppVariable not Reset value

edited September 2005 in General
Hello,

How do I do for the ppVariable its Reset value to each ppGroupHeaderBand?
the one that more is necessary to do, I am configuring its property
ResetType for veGroupBeforeHeader and non reset the value.

Version 7.04 D6

Comments

  • edited September 2005

    For most group based calculations you would set the Variable to Reset on
    GroupEnd.

    Below is an article from the Calculations thread of the Tech Tips newsgroup.
    Perhaps it will help answer your question. If not please create a simple
    example that demonstrates what you are trying to aacomplish and email to
    support@digital-metaphors.com in zip format. Please use standard Delphi
    components and the DBDemos data.


    ------------------------------------------------------
    Tech Tip: Calculating a Summary based on Group Totals
    ------------------------------------------------------

    Question: I am using a Variable in the Group Footer to conditionally
    calculate totals for each group. I want to add a second Variable to the
    Summary that accumulates the results calculated for each group.

    The following example uses two Variable components: vCustomerTotal and
    vCustomerSummary. The variable vCustomerTotal has its Timing defined to
    Reset on GroupEnd.


    There are two options for accumulating the summary total.

    1. Use the vCustomerTotal OnCalc event to accumulate the detail and the
    summary.

    example:

    procedure vCustomerTotalOnCalc(Sender: TObject; var Value: Variant);
    begin

    if (plCustomer['Amountpaid'] > 100.00) then
    begin
    {sum detail}
    Value := Value + plCustomer['Amountpaid'];

    {accumulate summary}
    vCustomerSummary.Value := vCustomerSummary.Value +
    plCustomer['Amountpaid'];
    end;

    end;


    2. Set the timing of the Summary OnCalc to "GroupBeforeFooter" and
    accumulate the detail variable results. Note that here we use
    GroupBeforeFooter because the detail variable has its Reset defined as
    "GroupEnd" - implying that if we try to use GroupEnd for our summary
    calculation the accumulated results will be 0.

    example:

    procedure vCustomerTotalOnCalc(Sender: TObject; var Value: Variant);
    begin

    {sum detail}
    if plCustomer['Amountpaid'] > 100.00 then
    Value := Value + plCustomer['Amountpaid'];

    end;


    procedure vCustomerSummaryOnCalc(Sender: TObject; var Value: Variant);
    begin

    {accumulate summary}
    Value := Value + vCustomerTotal.Value;

    end;


    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.