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

Calculation

edited November 2001 in General
Already posted but don't know if it was seen:
Hi, here i go again with calculation questions:
I have something like this:

Detail band:
Field1 Field2 Field3 DetVariable
Group footer:
FootVariable
Summary:
SumVariable

An need this odd calculation:
DetVariable = (Field1*Field2) / SUM(Field1*Field2*Field3) .... SUM

for the group
FootVariable = SUM(DetVariable) for the group
SumVariable=SUM(DetVariable) for the report

Is there a way to acomplish that?
thanks

--
Guillermo Castaño Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
GuillermoC@GrupoMillennium.com
www.GrupoMillennium.com

Comments

  • edited November 2001
    You'll need to use TppVariable components for this calculation. You'll need
    at least on in the detail band, one in the group footer, and one in the page
    footer. Use their OnCalc events to create the sums. The variable component
    can be set to reset when a group ends/starts. See the Timing dialog to
    control this by right clikcing over the variable in the designer.

    Variables can be set to Visible = False and they will still calculate their
    OnCalc event. You can control the order in which their OnCalcs fire through
    their CalcOrder property. This will ensure that you can calculate the
    numerator and denominator before your main OnCalc calculation fires.

    Access the datapipeline field values directly for the calculations:
    Value := plOrders['Amount Paid'] * plOrders['Amount Paid'];


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    I think if you can make DetVariable a calculated field, the other stuff will
    be easy. To do that, in the Data tab add a calculated field to the dataset,
    choose 'Expression' under 'Function' and for the expression enter something
    like:

    (tbl.Field1*tbl.Field2) / (tbl.Field1*tbl.Field2*tbl.Field3)

    Change the calc'd field's alias to 'DetVariable' and FootVar and SumVar
    should work as-is.

    Not sure about what SUM(Field1*Field2*Field3) is supposed to do though..


This discussion has been closed.