Home RAP

Using DBCalc's Count(FieldName) for counting non-empty records

edited October 2014 in RAP


Hi,

I'm wanting to put a summary count of the number of detail bands where a
field is not blank.

I have tried to use a DBCalc, set to "Count", and selecing the DataField
I am interested in. In this instance, the field contains a date/time if
an event has occurred, else that field is empty.

However, all I am getting is a total of the number of records.

From trawling through this newsgroup (after needing to find, download
and install a Newsgroup reader... seriously, who doesn't have a forum in
2014!?), I have found some other questions along a similar lines
(calculating totals based on the contents of a data field), and if I
understand correctly, I believe I can use a work-around of defining a
global variable, creating a dtInteger variable in the detail band,
setting the timing to calculate on traversal and performing the check
for whether this field is complete or not within the OnCalc - but I
would have hoped that simply dropping the dcCount into the summary and
selecing the field would have done the same job!

I'm currently using RB 15.05 build 275.


Thanks

Garry Mitchell

Comments

  • edited October 2014
    Hi Garry,

    The Count calculation will always give the entire count of the dataset
    up until that point in traversal. If you would like to filter the count
    value in any way, I suggest using a TppVariable and incrementing it's
    value based on certain specifications in the OnCalc event.

    Best Regards,

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