[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Tally records to a variable

     COUNT TO <idVar>
        [<scope>] [WHILE <lCondition>] [FOR <lCondition>]


     TO <idVar> identifies the variable that holds the COUNT result.  A
     variable that either does not exist or is invisible is created as a
     private variable whose scope is the current procedure.

     <scope> is the portion of the current database file to COUNT.  The
     default is ALL records.

     WHILE <lCondition> specifies the set of records meeting the
     condition from the current record until the condition fails.

     FOR <lCondition> specifies the conditional set of records to COUNT
     within the given scope.


     COUNT tallies the number of records from the current work area that
     match the specified record scope and conditions.  The result is then
     placed in the specified variable.  <idVar> can be a variable of any
     storage class including a field.


     .  This example demonstrates a COUNT of Branches in Sales.dbf:

        USE Sales NEW
        COUNT TO nBranchCnt FOR Branch = 100
        ? nBranchCnt                           // Result: 4

     .  This example tallies the number of records in Sales.dbf whose
        Branch has the value of 100 and assigns the result to the Count field
        in Branch.dbf for branch 100:

        USE Branch INDEX Branch NEW
        SEEK 100
        USE Sales INDEX SalesBranch NEW
        SEEK 100
        COUNT TO Branch->Count WHILE Branch = 100

 Files   Library is CLIPPER.LIB.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson