FIELD( ) Function

Example   See Also

Returns the name of a field, referenced by number, in a table.

Syntax

FIELD(nFieldNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nFieldNumber

Specifies the field number. If nFieldNumber is 1, the name of the first field in the table is returned; if nFieldNumber is 2, the name of the second field is returned, and so on. The empty string is returned if nFieldNumber is greater than the number of fields. Field names are returned in upper case.

nWorkArea

Specifies the work area of the table for which FIELD( ) returns field names.

FIELD( ) returns the empty string if a table isn't open in the work area you specify.

cTableAlias

Specifies the alias of the table for which FIELD( ) returns field names.

Visual FoxPro generates an error message if you specify a table alias that doesn't exist.

Remarks

If you omit the optional arguments, FIELD( ) returns the names of the fields in the table open in the currently selected work area.