Home RAP

summary calculation

edited July 2003 in RAP
Dear All

I would like to use RAP to code my own summary calculation (summary band).

Let's say that it's grouping report, each group consists of more than 1
page.

What I have done are as follow
1. I declared variable at module section -> var my_var: double
2. I coded someting like my_var := my_var + DBPipeline['my_field'] at
OnPrint of one of the DBText objects
3. I placed a Varible object on the summary band (because I want to display
summary of each page) and I coded to display the result of my_var at OnCalc
of Varible object -> Value := my_var

Once I tried to proview the report the result of my_var is the total of
entire group (not each page)

Please advise me where to place coding...

Thanks to all.
Kongthap Thammachat
jeud@yahoo.com
ICQ: 13026976

Comments

  • edited July 2003
    The OnPrint will fire more than once per record as the report generates. Use
    a TppVariable and code its OnCalc event handler to perform the calculation.
    This will guarantee that the value will be totalled only once for each
    record as the OnCalc fires for each record in the report. The report engine
    will fire the event handlers when it tries to generate a band. If the band
    won't fit on the page, then it has to fire those same events for hte same
    record on the next page when it tries to generate the band again where it
    has more space to fit. The variable takes part in a cache so that it has the
    correct value when its OnCalc fires twice across page breaks for the same
    record.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.