xHarbour Reference Documentation > Command Reference |
Counts records in the current work area.
COUNT TO <varName> ; [<Scope>] ; [WHILE <lWhileCondition>] ; [FOR <lForCondition>]
The COUNT command is used to count the number of records in the current work area based on the result of one or more logical expressions. The expressions are evaluated in the current work area. The number of records to include in the count can be restricted using a FOR and/or WHILE condition or by explicitely defining a scope.
See also: | AVERAGE, DbEval(), SUM, TOTAL, UPDATE |
Category: | Database commands |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example counts the number of sales that exceed a limit PROCEDURE Main LOCAL nSales := 0 USE Sales NEW COUNT TO nSales FOR FIELD->Amount * FIELD->Price > 500 USE ? "Sales of more than 500:", nSales RETURN
http://www.xHarbour.com