RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomClientDataSet.FindNearest Method

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

Pascal
procedure FindNearest(const KeyValues: array of const);
C++
__fastcall FindNearest(const array of const KeyValues);

Call FindNearest to move the cursor to a specific record in a dataset or to the first record in the dataset that matches or is greater than the values specified in the KeyValues parameter. If there are no records that match or exceed the specified criteria, FindNearest positions the cursor on the last record in the table. The KeyExclusive property controls whether matching values are considered. 

KeyValues contains a comma-delimited array of field values, called a key. 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.. For C++, KeyValues_Size specifies the index of the last value in the KeyValues array. This is one less than the number of key values.

Note: FindNearest works only with string data types.
 

 

FindKey 

GotoKey 

GotoNearest 

IndexName 

IndexFieldNames 

KeyExclusive 

Locate 

Executing a Search with Find Methods

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!