FieldRef.OptionCaption() Method

Version: Available or changed with runtime version 1.0.

Gets the option caption of the field that is currently selected.

Syntax

OptionCaption :=   FieldRef.OptionCaption()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

OptionCaption
 Type: Text

Remarks

The option caption of the field is returned as a comma-separated string.

If the field is not an Option, an empty string is returned.

This method returns an error if no field is selected.

Example

The following example opens the Item table as a RecordRef variable that is named ItemRecref. and creates a reference to field 19 (Price/Profit Calculation field), which is an Option field. The OptionCaption method retrieves the caption of the option field and displays the options as a comma-separated list.

var
    MyFieldRef: FieldRef;
    ItemRecref: RecordRef;
    OptionCaption: Text;
begin
    ItemRecref.Open(Database::Item);  
    MyFieldRef := ItemRecref.Field(19);  
    OptionCaption := MyFieldRef.OptionCaption;  
    Message('%1', OptionCaption);  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions