Remember that there is an error (at least as far back as D2006) that can cause you a big headache: if LogChanges is False, some of the filter functions do not work correctly: records may remain inside the filtered data set, even if their values do not match the specified ones filter criteria.
See unit test:
procedure TestCDS.TestLogChanges;
var CDS: TClientDataset;
begin
CDS := TClientDataset.Create(NIL);
try
CDS.FieldDefs.Add('MyStringField', ftString, 20 );
CDS.CreateDataSet;
try
CDS.LogChanges := False;
CDS.Filter := 'MyStringField is null';
CDS.Filtered := True;
Check( CDS.RecordCount= 0);
CDS.Insert;
CDS.Post;
Check( CDS.RecordCount= 1);
CDS.Edit;
CDS.FieldByName('MyStringField').AsString := 'Text';
CDS.Post;
Check( CDS.RecordCount= 0, 'Recordcount is not 0 after changing value!');
finally
CDS.Close;
end;
finally
CDS.Free;
end;
end;
, , , : http://www.delphigroups.info/2/f0/463155.html