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;
See Also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈