How does work the Count() function?


the question says it all. The documentation reads Returns the number of valid, non-blank values in a field. What is a value in there ?

It's Friday afternoon, and my mind just can't understand.

Many thanks

Non-blank means isempty (field) would return false. Valid applies to fields that expect a value type (date, time, timestamp). A ? in these fields indicates an invalid value.

And I forgot… value is anything, including nothing, in a field.

Just as it says. If a field is empty, it doesn't count :smile:

think of survey responses. Count how many people provided an answer to question 3.

I am copying a response to a private message to clarify my last post in this conversation.

A value, in the context of a field, is the field's content. If a field contains nothing, then nothing is its value. An empty value is still a value.

From a statistical perspective, empty values are omitted from statistical sets because they are considered invalid, missing or non-existant values. Empty values require a proxy to be considered in statistics. Proxy, here, could be a calculated field that equates empty to a non-empty value, such as true or false. IsEmpty (value) is one such calculation.

Hope this helps.

To sum up,

Count() works with the record set for the TO the Layout is based on - in fact the Found Set if a Find was executed. It goes through this set and count the fields that are not empty.

Whew, now I understand what the original developer was doing. He writes something in this field under a certain condition or wipe.

Count() in the hep file could benefit from a revision IMHO.

Count doesn't work on found sets. It works on a related set or a series of values. If you give it a field of the current context, it will only count the value of the current record.

There is a summary field type equivalent to Count. Summary fields source their values based on the found set.


Thanks for the added explanation.