FireDAC.Comp.DataSet.TFDDataSet.GotoNearest
[–] Properties | |
---|---|
Type: procedure function
| |
Visibility: public | |
Source: FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp
| |
Unit: FireDAC.Comp.DataSet | |
Parent: TFDDataSet |
Delphi
procedure GotoNearest;
C++
void __fastcall GotoNearest();
Description
Searches for a closest record, using values in the key buffer.
Use GotoNearest to search for a record, using values assigned to the indexed fields, after a previous call to SetKey/EditKey.
Before the call, the dataset must be in dsSetKey
state. If GotoNearest finds a record, it makes it the current record in the dataset. Otherwise, the first record with greater values than the specified values become the current record in the dataset.
Example
FDQuery1.IndexFieldNames := 'CUSTOMER_ID;ORDER_DATE';
FDQuery1.SetKey;
FDQuery1.FieldByName('CUSTOMER_ID').AsInteger := 100;
FDQuery1.FieldByName('ORDER_DATE').AsDateTime := EncodeDate(2008, 5, 1);
FDQuery1.GotoNearest;