RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomADODataSet.FilterGroup Property

Filters a recordset based on row update status.

Pascal
property FilterGroup: TFilterGroup;
C++
__property TFilterGroup FilterGroup;

Use FilterGroup to filter the recordset displayed with an ADO dataset component. The filter requires the dataset be in update batch mode and the rows are filtered based on the update status of individual rows. Set FilterGroup to a TFilterGroup constant to filter the dataset to show just the rows that match that batch update status. For instance, set FilterGroup to fgPendingRecords to show just the rows that have been modified since the last update application.

if (ADODataSet1.LockType = ltBatchOptimistic) then begin
  ADODataSet1.Filtered := True;
  ADODataSet1.FilterGroup := fgPendingRecords;
end;

 

if (ADODataSet1->LockType == ltBatchOptimistic)
{
  ADODataSet1->Filtered = true;
  ADODataSet1->FilterGroup = fgPendingRecords;
};

To use FilterGroup to filter based on the update status of rows, ensure that the LockType property is set to ltBatchOptimistic (a prerequisite for batch updating) and the Filtered property is set to true. In a filtered dataset, check the update status of individual rows using the RecordStatus property. 

The TFilterGroup type consists of the following constants:

Filter group type 
Meaning 
fgUnassigned  
Specifies that no filtering is in effect. This constant is used internally by the ADO dataset component.  
fgNone  
Removes any current filtering and all rows are visible. Can also be done by setting the Filtered property to false.  
fgPendingRecords  
Filters to show just the rows that have been changed and the changes have not been applied (UpdateBatch method) or canceled (CancelBatch).  
fgAffectedRecords  
Filters to show just the rows affected by the last update.  
fgFetchedRecords  
Filters to show just the rows in the current update cache. This is the results of the last call to retrieve rows from the database.  
fgPredicate  
Filters to show just deleted rows.  
fgConflictingRecords  
Filters to show just the rows that had changes made to them, but could not be applied due to errors on the apply attempt.  

See Recordset.Filter property 

 

LockType 

Filtered 

RecordStatus 

UpdateBatch 

CancelBatch 

Filtering Multiple Rows Based On Update Status

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!