Редагувати

Поділитися через


KeyRef.FieldCount() Method

Version: Available or changed with runtime version 1.0.

Gets the number of fields that have been defined in a key. Returns an error if no key is selected.

Syntax

No :=   KeyRef.FieldCount()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

No
 Type: Integer
The number of fields that have been defined in the key.

Example

The following example retrieves the number of fields that are defined in a key in record. The table with ID 18 (the Customer table) is open with a reference to table 18. The KeyIndex Method (RecordRef) method retrieves the second key in the record and store the KeyRef in the varKeyRef variable. The FieldCount Method (KeyREF) is then used to return the number of fields defined in the key and displayed in a message box.

var
    RecRef: RecordRef;
    varKeyRef: KeyRef;
    VarCount: Integer;
begin 
    RecRef.Open(18);  
    varKeyRef := RecRef.KeyIndex(2);  
    VarCount := varKeyRef.FieldCount;  
    Message('The number of fields defined in the key is: %1', VarCount);  
end;

KeyRef Data Type
Get Started with AL
Developing Extensions