Gets the number of fields in the table that are 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.
Count := RecordRef.FIELDCOUNT
- Type: RecordRef The RecordRef of the record that you use to identify the table.
Property Value/Return Value
The number of fields in the table.
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 function 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. This example requires that you create the following variables and text constants in the C/AL Globals window.
|Text constant name||DataType||ENU value|
The %1 table contains %2 field(s).\
FOR i := 3 TO 5 DO BEGIN MyRecordRef.OPEN(i); varFieldCount := MyRecordRef.FIELDCOUNT; MESSAGE(Text000, MyRecordRef.NAME, varFieldCount); MyRecordRef.CLOSE; END;