NAME Function (FieldRef)
Gets the name of a field as a string.
Name := FieldRef.NAME
The FieldRef of the field in the record.
Property Value/Return Value
Type: Text Constant or Code
The name of the field given as input.
The CAPTION Function (FieldRef, TestPage Field) function retrieves the Caption Property of a field. To enable your application for multilanguage functionality, you must use the FIELDCAPTION Function (Record) instead.
This function is similar to the FIELDNAME Function (Record) function.
The following example opens the Customer table as a RecordRef variable that is named CustomerRecref. The FIELD Function (RecordRef) creates a reference to the fields in the table and stores the FieldRef in the MyFieldRef variable. The code loops through field 1 through 5. For each field, the NAME function retrieves the name of the field and stores the value in the varName variable. The field number and the value in the varName variable are displayed in a message box. This example requires that you create the following variables and text constant in the C/AL Globals window.
|Text constant||ENU value|
|Text000||The name of field %1 is "%2".\|
FOR i := 1 TO 5 DO BEGIN CustomerRecref.OPEN(DATABASE::Customer); MyFieldRef := CustomerRecref.FIELD(i); varName := MyFieldRef.NAME; MESSAGE(Text000, i, varName); CustomerRecref.CLOSE; END;