Bewerken

Share via


FieldRef.GetEnumValueName(Integer) Method

Version: Available or changed with runtime version 4.0.

Gets an Enum value (or Option member) name from the Enum metadata for the field that is currently selected.

Syntax

The Enum value name :=   FieldRef.GetEnumValueName(Index: Integer)

Parameters

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

Index
 Type: Integer
The index in the list of Enum values to get the Enum value (or Option member) name for. The index is 1-based.

Return Value

The Enum value name
 Type: Text
The Enum value name.

Example

procedure GetOptionNo(Value: Text; FieldRef: FieldRef): Integer
    var
        FieldRefValueVar: Variant;
        FieldRefValueInt: Integer;
    begin
        if (Value = '') and (FieldRef.GetEnumValueName(1) = ' ') then
            exit(0);

        FieldRefValueVar := FieldRef.Value();
        FieldRefValueInt := -1;
        if Evaluate(FieldRef, Value) then begin
            FieldRefValueInt := FieldRef.Value();
            FieldRef.Value(FieldRefValueVar);
        end;

        exit(FieldRefValueInt);
    end;

FieldRef Data Type
Get Started with AL
Developing Extensions