Skip to main content

TcxDBDataController.GetRecordId(Integer) Method

Returns the key field value(s) for a data record.

Declaration

function GetRecordId(ARecordIndex: Integer): Variant; override;

Parameters

Name Type
ARecordIndex Integer

Returns

Type
Variant

Remarks

The GetRecordId function returns the key field value(s) of the record identified by the ARecordIndex parameter. This parameter specifies the record index, i.e. its position within the underlying dataset.

GetRecordId returns the key field values specified by the KeyFieldNames property. If the KeyFieldNames property contains several key field names, GetRecordId returns an array of variants corresponding to each key field.

Note that if key field names are not assigned, the function returns NULL.

Key field values uniquely identify each dataset record. Once you obtain the key field values, you can subsequently locate the record again, for instance, using the LocateByKey method. This is useful when you want to change a set of records (for instance, selected records). The safest approach is to store the key field values of the records to process and then loop through these records using the stored key field values. See example.

See Also