Function FieldName() Foundation

Return a field name from a work area.

Syntax
FieldName( <nPosition> ) --> cFieldName
Parameters
<nFieldPos>
<nFieldPos> is a positive integer specifying the ordinal position of a field within the record of a work area. The value for <nFieldPos> must be between 1 and FCount().
Return

The return value of FieldName() is a character string containing the name of the field at the position <nFieldPos> in the work area. When <nFieldPos> is not a valid field position in the work area, a null string ("") is returned.

Description

The database function FieldName() returns the name of an individual field from a record of a work area. If the function is used without the alias operator, the field name from the current work area is returned. The counterpart of FieldName() is the function FieldPos() which returns the position of the field in the record based on the field name.

Examples
FieldName()
// The example shows the use of FieldName() with and 
// without the alias operator 

PROCEDURE Main 
   USE Customer   ALIAS Cust NEW 
   USE Invoice   ALIAS Inv NEW 

   ? FieldName(1)              // result: INVNO 
   ? Cust->(FieldName(1))      // result: CUSTNO 

   CLOSE DATABASES 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.