RecordRef.FieldCount() Method

Version: Available or changed with runtime version 1.0.

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

Syntax

Count :=   RecordRef.FieldCount()

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 fields in the table.

Example

The following example loops through tables 3 through 5 and displays the number of fields that are defined in each table. The code starts by opening table 3 (Payment Terms) as a RecordRef variable that is named MyRecordRef. MyRecordRef variable uses the FieldCount method to retrieve the number of fields that are defined in the table and stores it in the varFieldCount variable. The name of each table and the total number of fields in the table are displayed in a message box. The table that is open is closed before the next one is open.

var
    MyRecordRef: RecordRef;
    varFieldCount: Integer;
    Text000: Label 'The %1 table contains %2 field\(s\).\\';
begin    
    for i := 3 to 5 do begin  
      MyRecordRef.Open(i);  
      varFieldCount := MyRecordRef.FieldCount;  
      Message(Text000, MyRecordRef.Name, varFieldCount);  
      MyRecordRef.Close;  
     end;  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions