Declare one or more database field names to be used by the current routine.
FIELD <idFieldList> [IN <idAlias>]
|<idFieldList>||A list of names to declare as fields to the compiler.|
|IN <idAlias>||An alias to assume when there are unaliased references to the names specified in the <idFieldList>.|
When you use the FIELD statement to declare fields, unaliased references to variables in <idFieldList> are treated as if they were preceded by the special field alias (_FIELD->) or <idAlias>-> if the IN clause is specified.
Like other variable declaration statements (i.e., LOCAL and MEMVAR), you must place FIELD statements before any executable statements (including PRIVATE, PUBLIC, and PARAMETERS) in the routine you are defining. The FIELD statement has no effect on the macro operator, which always assumes memory 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 that are known to exist at runtime. Attempting to access the fields when the associated database is not in use will raise a runtime error.
This function includes statements to declare database field names in both the current and Employee work areas:
FIELD CustNo, OrderNo, Orders
FIELD EmpName, EmpCode IN Employee
USE employee NEW
USE orders NEW
? CustNo // Refers to Orders->CustNo
? EmpName // Refers to Employee->EmpName
DBFieldInfo(), LOCAL, MEMVAR, STATIC