count
Syntax
result = COUNT(FACS_name, '<search statement>')
Arguments
result: integer
FACS_name: FACS database name
search statement: text
Meaning
COUNT (available from Designer 7.7.4.2658, adapl.exe 7.6.21279.1 and Collections 1.12) counts the number of field occurrences or field group occurrences matching the search statement in the named, open FACS record or in a _LOCAL record (to address the currently open database table). The search statement can be something similar to an advanced search:
• | the syntax of a singular search is: field operator value |
• | operators can be =, <, >, >= and <= |
• | multiple singular searches can be combined with AND, AND NOT, OR and WHEN |
• | WHEN can only be used on grouped fields and WHEN can be used more than once in a search statement |
Example
number = count(COLLECT, 'kj=Lang* when ki=person when kn=retired')
Result
number takes as value the number of field group occurrences in which a field tag kj has the truncated value 'Lan' whilst the same occurrence of field tags ki and kn have the values 'person' and 'retired' respectively.
kj |
ki |
kn |
Lang, Howard |
person |
retired |
Lange, Erik |
person |
active |
Lansing, Jack |
person |
retired |
If the relevant field group would contain the data above, number would result in 1.
Note that the number of found records, not occurrences in the current record, after a READ WHERE, READ USING or READ POINTER can be obtained from the &W reserved variable.