FireDAC.Comp.DataSet.TFDDataSet.EmptyView

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type:
procedure
function
Visibility: public
Source:
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
Unit: FireDAC.Comp.DataSet
Parent: TFDDataSet

Delphi

procedure EmptyView;

C++

void __fastcall EmptyView();

Description

Removes all records visible in the dataset from the internal data storage of the dataset.

Call EmptyView to remove all records visible in the dataset from the internal data storage and from the changes log. This method is similar to EmptyDataSet. However, EmptyDataSet removes all records, while EmptyView removes the records accessible in the dataset after applying filters, ranges, etc.

Example

var
  i: Integer;
.....
  FDMemTable1.Close;
  FDMemTable1.FieldDefs.Clear;
  FDMemTable1.FieldDefs.Add('f1', ftInteger);
  FDMemTable1.FieldDefs.Add('f2', ftString, 20);
  FDMemTable1.CreateDataSet;
  for i := 1 to 100 do
    FDMemTable1.AppendRecord([i, 'qwe' + IntToStr(i)]);
  FDMemTable1.IndexFieldNames := 'f1';

  // remove all records with f1 >= 30 and f1 <= 60
  FDMemTable1.SetRange([30], [60]);
  FDMemTable1.EmptyView;
  FDMemTable1.CancelRange;

See Also