編集

次の方法で共有


FieldRef.Length() Method

Version: Available or changed with runtime version 1.0.

Gets the maximum size of the field (the size specified in the DataLength property of the field). This method is usually used for finding the defined length of code and text fields.

Syntax

Length :=   FieldRef.Length()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Length
 Type: Integer

Remarks

For Text and Code fields this method returns the defined length. For other types of fields, it returns the fixed byte size, for example, Integer fields returns 4.

Example

The following example opens the Customer table as a RecordRef variable. The Field Method (RecordRef) creates a FieldRef for any specified field and stores the reference in the MyFieldRef variable. The LENGTH method retrieves the maximum size of the field and stores the value in the varLength variable. The value that is stored in the varLength is displayed in a message box.

var
    MyFieldRef: FieldRef;
    CustomerRecref: RecordRef;
    varLength: Integer;
    varFieldNo: Integer;
    Text000: Label 'The maximum size of the field is %1.';
begin  
    varFieldNo := 1;  
    CustomerRecref.Open(Database::Customer);  
    MyFieldRef := CustomerRecref.Field(varFieldNo);  
    varLength := MyFieldRef.Length();  
    Message(Text000, varLength);  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions