RecordRef.KeyCount() Method

Version: Available or changed with runtime version 1.0.

Gets the number of keys that exist in the table that is referred to by the RecordRef. Returns an error if no table is selected.

Syntax

Count :=   RecordRef.KeyCount()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Count
 Type: Integer
The number of keys that have been identified in the table.

Example

The following example opens the Customer table (18) as a RecordRef variable that is named CustomerRecref. The KeyCount method retrieves the number of keys that are defined in the Customer table. The return value of the method is stored in the KeyCount variable and displayed in a message box. The KeyCount variable contains the number 13 because 13 keys are defined in the Customer table.

var
    CustomerRecref: RecordRef;
    KeyCount: Integer;
    Text000: Label 'The table has %1 keys.';
begin     
    CustomerRecref.Open(18);  
    KeyCount := CustomerRecref.KeyCount;  
    Message(Text000, KeyCount);  
end;
  

RecordRef Data Type
Get Started with AL
Developing Extensions