C5_FCOUNT

 FCOUNT()
 Return the number of fields in the current .dbf file
------------------------------------------------------------------------------
 Syntax

     FCOUNT() --> nFields

 Returns

     FCOUNT() returns the number of fields in the database file in the
     current work area as an integer numeric value.  If there is no database
     file open, FCOUNT() returns zero.

 Description

     FCOUNT() is a database function.  It is useful in applications
     containing data-independent programs that can operate on any database
     file.  These include generalized import/export and reporting programs.
     Typically, you use FCOUNT() to establish the upper limit of a FOR...NEXT
     or DO WHILE loop that processes a single field at a time.

     By default, FCOUNT() operates on the currently selected work area.

 Examples

     .  This example illustrates FCOUNT(), returning the number of
        fields in the current and an unselected work area:

        USE Sales NEW
        USE Customer NEW
        ? FCOUNT()                     // Result: 5
        ? Sales->(FCOUNT())            // Result: 8

     .  This example uses FCOUNT() to DECLARE an array with field
        information:

        LOCAL aFields := ARRAY(FCOUNT())
        AFIELDS(aFields)

     .  This example uses FCOUNT() as the upper boundary of a FOR loop
        that processes the list of current work area fields:

        LOCAL nField
        USE Sales NEW
        FOR nField := 1 TO FCOUNT()
           ? FIELD(nField)
        NEXT

 Files   Library is CLIPPER.LIB.

See Also: AFIELDS()* FIELDNAME() TYPE()



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.