Command COUNT Foundation
Determines the number of records matching a condition.
COUNT TO <VarName> ; [FOR <lForCondition>] ; [WHILE <lWhileCondition>] ; [NEXT <nCount>] ; [REST] ; [ALL]
The result of the command COUNT is assigned to the variable <VarName>. If the variable does not exist, it is created as a PRIVATE variable.
<lForCondition> is an optional logical expression defining a condition. A record is counted only if <lForCondition> returns the value .T. (true).
<lWhileCondition> is an optional logical expression defining a condition. The counting of the records is terminated as soon as the expression returns the value .F. (false).
<nCount> specifies the number of records to be considered during counting, starting with the current record.
The option REST determines whether records are to be considered only from the current record to the last record. If a condition is specified, the option ALL is the default value.
The option ALL specifies that all records are considered. If a condition is specified, the condition is tested for all records.
The command COUNT counts the number of records in the current work area matching the specified condition. The count range can be limited by options such as NEXT or REST. The count result is assigned to the variable <VarName>.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.