Record.FieldName(Any) Method

Version: Available or changed with runtime version 1.0.

Gets the name of a field as a string.

Syntax

Name :=   Record.FieldName(Field: Any)

Parameters

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

Field
 Type: Any
The name of the field in the record.

Return Value

Name
 Type: Text

Remarks

The advantage of using the FieldName method call instead of a static assignment, like NameOfField := 'MyField', is that using the FieldName method dynamically adapts to any change to the field name made in the development environment.

Example

The following example gets the name of the No. field in the Customer table, and stores it in a string.

var
    NameOfField: Text;
    CustomerRec: Record Customer;

begin
    NameOfField := CustomerRec.FieldName("No.");
end;

See Also

Record Data Type
Get Started with AL
Developing Extensions