TurboDB VCL Component Library

Selections and Drill-Down

Previous  Top  Next

TurboDB provides an extension over the regular filters the VCL offers. A selection is a subset of records, which can be manipulated by adding and removing single records, applying filter conditions and word filter conditions. The subset can be used for example to manage a multi-selection of records in a grid, to implement drill-down capability or to realize the functionality of the SQL operators UNION, INTERSECT and EXCEPT on the TTdbTable level. Selections can also be used as filters.

To filter out the records with record no 54821 and 897003:

MyTable.Filtered := True;

To filter out all cars that are from BMW and have red color incrementally (drill-down):

MyTable.Filter = 'Manufacturer = ''BMW''';
MyTable.Filtered := True;
// Now all BMWs are shown
MyTable.AddToSelection('Color = ''red''');
// Now all red BMWs are in the selection
// Now all red BMWs are shown
MyTable.Filtered := False;
// All cars are shown again.

To delete all red BMWs incrementally:

MyTable.AddToSelection('Manufacturer = ''BMW''');
MyTable.IntersectSelection('Color = ''red''');
while not MyTable.BOF do begin
  if MyTable.IsSelected(MyTable.RecNo) then

When a data set has a filter set but the Filtered property is false, the records that satisfy the filter condition make up the current selection. It can be modified using the AddToSelection, RemoveFromSelection and IntersectSelection methods. The FindFirst and FindNext methods can be used to browse through the current selection.

See also

DrillDown Demo Program
AddToSelection method
RemoveFromSelection method
IntersectSelection method
ActivateSelection method
IsSelected method
ClearSelection method