TurboDB VCL Component Library

TTdbTable.FindNearest

TTdbTable

Previous  Top  Next

Moves the cursor to the record that most closely matches a specified set of key values.

Delphi syntax:

procedure FindNearest(const KeyValues: array of const);

C++ syntax:

void __fastcall FindNearest(const System::TVarRec* KeyValues, const int KeyValues_Size);

Description

Call FindNearest to move the cursor to a specific record in a dataset or to the first record in the dataset that is greater than the values specified in the KeyValues parameter. KeyValues contains a comma-delimited array of field values, called a key. Each value in the key can be a literal, a variable, a null, or nil. If the number of values passed in KeyValues is less than the number of columns in the index used for the search, the missing values are assumed to be null.

The key must always be an index, which can be specified in the IndexName property. If IndexName is empty, FindNearest uses the table's primary index.

FindNearest positions the cursor either on a record that exactly matches the search criteria, or on the first record whose values are greater than those specified in the search criteria.