FieldRef.Name() Method

Version: Available or changed with runtime version 1.0.

Gets the name of a field as a string.

Syntax

Name :=   FieldRef.Name()

Note

This method can be invoked using property access syntax.

Parameters

FieldRef
 Type: FieldRef
An instance of the FieldRef data type.

Return Value

Name
 Type: Text

Remarks

The Caption Method (FieldRef, TestPage Field) method retrieves the Caption Property of a field. To enable your application for multilanguage functionality, you must use the FieldCaption Method (Record) instead.

This method is similar to the FieldName Method (Record).

Example

The following example opens the Customer table as a RecordRef variable that is named CustomerRecref. The Field Method (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 method 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.

var
    MyFieldRef: FieldRef;
    CustomerRecref: RecordRef;
    varName: Text;
    i: Integer;
    Text000: Label 'The name of field %1 is "%2".\\';
begin
    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;  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions