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

Sub total calculation (REPOST + more data but I really need help)

edited June 2001 in General
ORIGINAL MESSAGE

----------------------------------------------------------------------

Hi again,

I have seen in the news group that there are problems with calculations on
DBCalc and Variables.

In fact I have experienced it : I have a group that expands through three
pages and it happens the following

The calculated sub total of the first page contains the addition of the
quantity of the first record of the following page.

For the second page is similar.

The third and last page have sub total is what it should be minus the
quantity of the first record appearing in that page.

Is there any work around?

Thanks

Felix

----------------------------------------------------------------------

MORE DATE

----------------------------------------------------------------------

I've put a Variable1, a Variable2 and a DBCalc side by side on the page
footer with the following settings

----------------------------------------------------------------------

Variable 1

Autosize = TRUE
CalcType = veTraversal
DataType = dtDouble
ResetType = vePageStart

Variable1.OnCalc Event
Value := Value + DM.Operaciones ['ImporteTotal'];

----------------------------------------------------------------------

Variable 1

Autosize = TRUE
CalcType = veTraversal
DataType = dtDouble
ResetType = vePageStart

Variable1.OnCalc Event
Variable2.Value := Variable2.Value + DM.Operaciones ['ImporteTotal'];

----------------------------------------------------------------------

DBCalc

DataField = The one I one to sum
DataPipeline = The same pipeline of the report
DBCalcType = dcSum
ResetGroup = the group in the detail

----------------------------------------------------------------------

Everything is on the page footer


Thanks again

Comments

  • edited June 2001
    I've responded via email to your email to support@. For those interested,
    the issue is with a dynamic height detail band with a calculation. So, the
    workaround is to use the AfterPrint event of the detail band to assign the
    value of an invisible dbCalc, in the detail band, to a variable in the
    footer. Eventhough the dbCalc in the detail band is invisible, it will
    always calculate.

    procedure TForm1.ppDetailBand1AfterPrint(Sender: TObject);
    begin

    if (ppReport1.Detail.SpaceUsed > 0) then
    ppVariable1.Value := ppDBCalc1.Value;

    end;

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.