Data.DB.TDataSet.FindPrior

From RAD Studio API Documentation
Jump to: navigation, search

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

Code Examples