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

Determining if a Group Header has already printed

edited May 2002 in General
I need to know how to determine if a Group Header has already printed on
another page. On the BeforeGenerate event of a Group Header I do some
calculations that must only be done once (adding a value to a running
total). I have the Group Header setup to reprint if the Group goes across
multiple pages. The problem that I am having is that the BeforeGenerate
fires every time the Group Header actually prints (which is fine) so I am
double counting some values in teh running total. I need to be able to
determine if this is the first time the Group Header is printing or whether
it has printed before so that I can add the value to the running total only
once.

Thanks,

Scott Rowat.

Comments

  • edited May 2002
    Create a boolean variable that you initialize to false. In the GroupHeader
    BeforePrint check if the variable is false, if it is, set it to true and
    perform your calculations, otherwise do nothing. Reset the variable in the
    GroupHeader's Before/AfterPrint back to false. This way you'll ensure that
    if the group spills onto another page you'll only be performing calculation
    once per group.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    You can also use a TppVariable, code its OnCalc event handler to do the
    calculation, and set its timing to calculate based on a group start instead
    of on the data pipeline traversal. The timing is accessible by right
    clicking over the variable component and in the popup menu there is
    Timing... option which will launch the timing dialog where you can set this
    up.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.