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

Hard headed for OnCalc?

edited November 2001 in General
Hi, i don't know what am i doing wrong but:
Have a footer group and summary variables. All i want to do is SUM the
multiplication of some fields.
So the variable in the group footer has:
CalcType: veTraversal
ResetComponent: ppGroup1
ResetType:veGroupStart
The OnCalc: Value:= Value +
MyPipeLine.GetFieldAsDouble('field1')*MyPipeLine.GetFieldAsDouble('field2');

The summary variable has:
CalcType: veTraversal
ResetType:veReportEnd
The OnCalc: Value:= Value +
MyPipeLine.GetFieldAsDouble('field1')*MyPipeLine.GetFieldAsDouble('field2');

I have only one group in the report but the summary values are slightly
higher than the footer group band ones. They should be exactly equal!
What's wrong?
--
Guillermo Castaño Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
GuillermoC@GrupoMillennium.com
www.GrupoMillennium.com

Comments

  • edited November 2001
    I get the same behavior. Set the group footer variable to reset on group end
    instead of on group start. It should start working with that setting.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    OK, i'll try it... but have a question. Why is that, what's the difference
    between group end and group start?
    thanks

  • edited November 2001
    Ok, i have the same answer in the group and in the summary... but both are wrong!
    If i export the report to excel and check the values, both are wrong.

    The situation:
    Have fields A, B and C.
    I need two totals in the group footer and in the report summary. Each total must
    be:
    Total1: SUM(A*B*C)
    Total2: SUM(A*C)

    I already tried to calculate them in two ways:
    1. Having a variable in the footer, calc ontraversal, reset ongroupend.
    Value := Value +
    (Pipeline.GetFieldAsDouble('A')*Pipeline.GetFieldAsDouble('B')*Pipeline.GetFieldAsDouble('C'));

    The value calculated is wrong.
    2. Another approach, invisible variables in the detail of the reports. One
    calculating A*B*C the other A*C. The values calculated in the detail are OK,
    but... in the same OnCalc i'm calculating the total doing:
    VariableInTheFooter.Value := VariableInTheFooter.Value + Value;
    The value obtained is the same wrong value that in approach 1.

    Please, help me... i need to deploy the report and can't make it work.
    thanks

  • edited November 2001
    For some reason the OnCalcs aren't doing what you need. Can you send me an
    example and I'll look at it to see what's happening. I have an example
    which is working as I expect it. I added the values manually and they were
    correct and I also created a calc field on the dataset and it came up with
    the same number as well.

    Perhaps, it may be easier to create calculated fields in the dataset for the
    (A*B) and (A*B*C) calculations, for each record. Then use DBCalcs to sum
    their values.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    I downloaded the attachment- and yes, we delete attachments to our
    newsgroup:)


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    I see there is only a spreadsheet in the zip file. We'll need to run a
    report to see what the problem is. Can you create a simple one for us that
    shows the error- this would be the fastest way for us to get the report
    working for you.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    What files do you need? I can send you the .pas and .dfm files, there are the
    OnCalcs, dataset and pipelines.
    Is that enough? Send it via mail?
    thanks for your help

  • edited November 2001
    I'm sending you the current files in order to see if i have something wrong...
    send you an example with the DBDemos database ASAP.
    bye

  • edited November 2001
    I tried to reproduce the wrong behaviour with the dbdemos database but all works
    as expected, calculations are perfect!!
    Don't know what can be wrong, the dbdemos test i made has the same logic and
    calculation than the real wrong application.
    thanks

This discussion has been closed.