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

OnCalc fires to often

edited January 2003 in RAP
We do some calculations in the OnCalc-event of a variable
positioned in the detail-band and sum the this variable
to another global one which we are displaying in a group
footer band.

The calculations aren't correct when the report
has more than one page.

After some investigations, we found out, that the
OnCalc-event is triggered more than once for the
last row of a page. The first row of the next page
has then a wrong content.

When we display page number 3 and change back to
page number 2 the first row shows the correct content.

We are using Delphi 5 and ReportBuilder 7.01 Enterprise.

Comments

  • edited January 2003
    Hi Christian,

    The OnCalc may fire more than once, however, because the values are cached
    by the report engine, it should work. If you do not store the value in the
    variables, then it may become out of sync with the cache manager. The
    OnCalcs have to fire more then once in order to support page breaks and
    KeepTogether support. It work because the cache manager restores the values
    of the variables to the previous value before the page break so that the
    next time they calculate, they will do so with the same value as if the
    KeepTogether "determination generation" never happened


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2003
    > The OnCalc may fire more than once, however, because the values are cached

    Well, in our case we have a sum variable positioned in a group band
    and a calculation started in the OnCalc of the detail band and it
    becomes
    out of sync.

    So it seems that the restore logic doesn't work in all cases.
    Are the variables of all bands restored or just the variables of the
    detail band?

    CL
  • edited January 2003
    That setup should work. Are the values stored anywhere else other than
    TppVariables? Can you send a simple example to support@digital-metaphors.com


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.