Rediger

Del via


TestField.Caption() Method

Version: Available or changed with runtime version 1.0.

Gets the current caption of the field as a String.

Syntax

Result :=   TestField.Caption()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Result
 Type: Text
The current caption of the field as a String.

Remarks

Caption returns the caption of a field. Caption first looks for a CaptionML Property.

If it does not find one, it will use the Name Property. This means that Caption is enabled for multilanguage functionality.

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

Example

The following example opens table 18 (Customer) as a RecordRef variable that is named CustomerRecref. The code uses the Field Method (RecordRef) to loop through field 1 through 9 and creates a FieldRef variable that is named MyFieldRef. For each field, the Caption method retrieves the caption of the field, stores it in the varCaption variable and displays it in a message box.

var
    CustomerRecRef: RecordRef;
    MyFieldRef: FieldRef;
    varCaption: Text;
    i: Integer;
    Text000: Label 'The caption for field %1 is "%2".';
begin
    CustomerRecref.Open(18);  
    for i := 1 to 9 do begin  
      MyFieldRef := CustomerRecref.Field(i);  
      varCaption := MyFieldRef.Caption;  
      Message(Text000, i, varCaption);  
    end;  
    CustomerRecref.Close;  
end;

See Also

TestField Data Type
Get Started with AL
Developing Extensions