Function IsFieldVar() Foundation
Checks if a symbolic name indicates a field variable
IsFieldVar( <cVarName> ) --> lExist
The function returns .T. (true) if a field variable with the name <cVarName> exists, otherwise it returns .F. (false).
The function IsFieldVar() checks whether or not a character string matches the name of a field variable. If this is the case, the field variable can be accessed or changed using the macro operator. However, when using the macro operator it must be guaranteed that no dynamic memory variable with the name<cVarName> exists at the same time. Otherwise, IsFieldVar() may return .T. but the expression &cVarName may return the value of a memory variable rather than the field variable's value. This depends on the compiler switch /v.
// The example shows two possibilities to test
// whether or not a field variable exists.
PROCEDURE Main
LOCAL cVarname := "Lastname"
USE Customer
IF IsFieldVar( cVarname )
? FIELD->&cVarname // result: Miller
ENDIF
IF FieldPos( cVarname ) > 0 // alternative for IsFieldVar()
? FIELD->&cVarname
ENDIF
USE
RETURN
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.