FireDAC.Comp.DataSet.TFDDataSet.FindNearest

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure FindNearest(const AKeyValues: array of const);

C++

void __fastcall FindNearest(const System::TVarRec *AKeyValues, const int AKeyValues_High);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
FireDAC.Comp.DataSet TFDDataSet

Description

Searches for a record containing specified index field values.

Use FindNearest to search for the record in an indexed dataset, using specified index field values. 

AKeyValues is an open array containing field values, called a key. Each value in the key can be a literal, a variable, or nil. If the number of values passed in AKeyValues is less than the number of columns in the index used for the search, the missing values are assumed to be nil

If a search is successful, FindNearest positions the cursor on the matching record and returns True. Otherwise, it positions the cursor on the record that is greater than the specified key.

Example

FDQuery1.IndexFieldNames := 'F1;F2';
FDQuery1.FindNearest([100, 'qwe']);

See Also