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

Running totals and Distinct counts

edited April 2006 in General
Hi.
I have created a report in which I need to calculate the "distinct count"
of a record. Each Master record has many detail records, and thus the
field appears many times. Is there a way of doing this using a DB Calc
function?
Also, I have tried to do this using an event "before generate",
eg count :=count+1 (This is in the group header)
but it seems that the count increases by 2 on each page break, ie 1
number missed. I have turned off the reprint group header, and keep group
together.

Any ideas?

Thanks



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited April 2006
    Hi,

    For future reference, we prefer that you use your real name when posting to
    these newsgroups.

    You will need to use the OnCalc event of a TppVariable in order to ensure
    that the event fires only once per traversal. Placing an invisible variable
    in your report would give you access to an OnCalc event.

    Another option would be to calcualte the distince count before the report
    generates using a different dataset and SQL code. This option would be much
    easier.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.