Data.DB.TDataSet.FindLast
Delphi
function FindLast: Boolean;
C++
bool __fastcall FindLast(void);
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | Data.DB.pas Data.DB.hpp |
Data.DB | TDataSet |
Description
Implements a virtual method for positioning the dataset on the last record, respecting any filters.
FindLast is intended to be used together with FindPrior, FindFirst and FindNext in order to search for the last record using any filters. See the example.
- Notes:
Descendant classes override FindLast to make the last record active, honoring any filters that are in effect. In descendants, FindLast returns true:
True
-- if the active record is successfully changed.False
-- if the active record is not successfully changed.
Example
Here is a code snippet that shows how to use FindLast and FindPrior to search for a record using a filtering expression:
Delphi:
FDQuery1.Filter := 'amount >= 10000';
if FDQuery1.FindLast then
repeat
// do something
until not FDQuery1.FindPrior;
C++:
FDQuery1->Filter="amount >= 10000";
if (FDQuery1->FindLast()){
do {
// do something
}
while (FDQuery1->FindPrior());
}