Redigera

Dela via


FieldRef.Class() Method

Version: Available or changed with runtime version 1.0.

Gets the value of the FieldClass Property of the field that is currently selected. This method returns an error if no field is selected.

Syntax

Class :=   FieldRef.Class()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Class
 Type: FieldClass

Remarks

The FieldRef refers to the field that you are interested in.

The Class method returns the class as an Option. However, you cannot assign the class to an Option variable directly. Instead, you must use the Evaluate Method. The Evaluate method has a variable parameter to which the value is assigned and a string parameter. You use the Format method to convert the result of the FieldRef.Class method to Text, and then use the Evaluate method to convert the Text to an Option.

Example 1

In this example, the return value of the Class method is converted to Text and then converted to an Option. The value of the OptionString property of OptionVar is Normal,FlowFilter,FlowField.

var
    OptionVar: Option;
    FldRef: FieldRef;
begin
    Evaluate(OptionVar,Format(FldRef.Class));  
end;

Example 2

In this example, the return value of the Class method is converted to Text and then converted to an Option. This example uses the Field virtual table instead of an Option variable. The Field virtual table has a Class field, which is an Option and already has the correct OptionString.

var
    FieldRec: Record Field;
    FldRef: FieldRef;
begin
    Evaluate(FieldRec.Class,Format(FldRef.Class));  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions