Declare database field names

     FIELD <idField list> [IN <idAlias>]


     <idField list> is a list of names to declare as fields to the

     IN <idAlias> specifies an alias to assume when there are unaliased
     references to the names specified in the <idField list>.  Unaliased
     references to variables in <idField list> are treated as if they are
     preceded by the special field alias (FIELD->).


     The FIELD statement declares the names of database fields to the
     compiler, and optionally supplies an implicit alias for each name.  This
     allows the compiler to resolve references to variables with no explicit
     alias--by implicitly assuming the specified <idAlias>.  Only explicit,
     unaliased references to the specified fields in the <idField list> are
     affected.  The FIELD statement, like all declarations, has no effect on
     references made within macro expressions or variables.

     The FIELD statement neither opens a database file nor verifies the
     existence of the specified fields.  It is useful primarily to ensure
     correct references to fields whose accessibility is known at runtime.
     Attempting to access the fields when the associated database is not in
     USE will cause an error.

     The scope of the FIELD declaration is the procedure or function in which
     it occurs, or the entire program (.prg) file if the declaration precedes
     all PROCEDURE or FUNCTION declarations and the /N compiler option is

     FIELD statements, like other declarations, must precede any executable
     statements in the procedure or function definition or the program (.prg)
     file if the declaration has filewide scope.

     FIELD used with the /W compiler option performs compile-time checking
     for undeclared variables.

     For more information on variable declarations and scoping, refer to the
     Variables section in the "Basic Concepts" chapter of the Programming and
     Utilities Guide.


     .  This user-defined function includes statements to declare
        database field names in both the current and Employee work areas:

        FUNCTION DisplayRecord
           FIELD CustNo, OrderNo, Salesman
           FIELD EmpName, EmpCode IN Employee
           USE Employee NEW
           USE Orders NEW
           ? CustNo               // Refers to Orders->CustNo
           ? EmpName              // Refers to Employee->EmpName
           CLOSE Orders
           CLOSE Employee
           RETURN NIL


4 responses to “C5_FIELD

  1. Pingback: Variable Handling | Viva Clipper !

  2. Pingback: C5 Statements | Viva Clipper !

  3. Pingback: C5_PRIVATE | Viva Clipper !

  4. Pingback: C5_MEMVAR | 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.