C5_COUNT

 COUNT
 Tally records to a variable
------------------------------------------------------------------------------
 Syntax

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

 Arguments

     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.

 Description

     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.

 Examples

     .  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.

See Also: AVERAGE DBEVAL() SUM TOTAL

 

Advertisements

2 responses to “C5_COUNT

  1. Pingback: DB Commands | Viva Clipper !

  2. Pingback: C5 Commands | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.