Version: Available or changed with runtime version 1.0.
Gets the FieldRef of the field that has this index in the key referred to by the KeyRef variable. Returns an error if no key is selected.
Field := KeyRef.FieldIndex(Index: Integer)
An instance of the KeyRef data type.
The input index.
The FieldRef that refers to the field with this index in the key.
The first field in the index must have index 1, the second index 2, and so on. The last field must have index = FieldCount. If the index is out of the range supplied or if no table is selected, the method returns an error.
The following example displays the caption of a field in a record. The table with ID 18 (the Customer table) is open with a reference. The Keyref for the record is retrieved by using the KeyIndex Method (RecordRef). The method retrieves the second key in the record and stores the value in the varKeyRef variable. The varKeyRef variable is then used to return the FieldRef. The varFieldRef variable is used to display the caption of the field.
var RecRef: RecordRef; varKeyRef: KeyRef; varFieldRef: FieldRef; begin RecRef.Open(18); varKeyRef := RecRef.KeyIndex(2); varFieldRef := varKeyRef.FieldIndex(1); Message('The Field name is: %1' ,varFieldRef.Caption); end;
Submit and view feedback for