Data.DB.TDataSet.FindPrior
Delphi
function FindPrior: Boolean;
C++
bool __fastcall FindPrior();
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 previous record, respecting any filters.
FindPrior is intended to be used together with FindLast, FindFirst and FindNext in order to search for the prior record using any filters. See the example.
- Notes:
Descendant classes override FindPrior to move to the previous record of the dataset, honoring any filters that are in effect. In descendants, FindPrior returns:
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());
}
See Also
- Data.DB.TDataSet.Filter
- Data.DB.TDataSet.Filtered
- Data.DB.TDataSet.OnFilterRecord
- Data.DB.TDataSet.FindFirst
- Data.DB.TDataSet.FindLast
- Data.DB.TDataSet.FindNext
- Data.DB.TDataSet.Prior