COUNT function counts the number of non-blank values in a subform's field, in one or more fields, or in a multiple-select field.
COUNT(VALUE1, VALUE2, VALUE3, ...)
When used with subform fields, the argument to
COUNT() must include a reference to the form's subform field and then the field within the subform, using the dot notation.
COUNT function accepts arguments of any type.
If you have a household survey form with a "Members" subform, you can use the
COUNT function to count the number of members in the household:
This will count the number of members for each household record with a non-blank
If you want to count all subrecords of the record, you can also write:
Here, we refer to the record's built-in, auto-generated ID using the
_id symbol. Since every record always has an ID, this effectively counts all records.
If you have three optional fields in a form for different types of phone numbers, you might want to know how many non-blank phone numbers have been provided.
For example, you could write:
COUNT(FIXED_LINE_PHONE_NUMBER, MOBILE_PHONE_NUMBER, OTHER_NUMBER)
If the respondent has provided a value for all three fields, the result will be three. If they have only provided a fixed line and mobile number, the result will be 2.