Muokkaa

Jaa


FieldRef.Caption() Method

Version: Available or changed with runtime version 1.0.

Gets the current caption of a field as a String.

Syntax

Caption :=   FieldRef.Caption()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Caption
 Type: Text

Remarks

The Caption method 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).

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
    MyFieldRef: FieldRef;
    CustomerRecref: RecordRef;
    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;

FieldRef Data Type
Get Started with AL
Developing Extensions