RecordCount not working properly when filtered

Hi

Here attached an example about AureliusDataset recordcount, when filtered, not working.
Thank you.

tms-teste2.zip (54.7 KB)

Thank you for the project, Thiago. That's expected behavior, as your dataset is filtered and didn't reach the end of records yet, so TAureliusDataset doesn't know which records are supposed to be filtered.

To improve this, we have added a new RecordCountMode named TRecordCountMode.FetchAll which will force all records to be loaded for the record count to be correct in this situation:

AureliusDataset1.RecordCountMode := TRecordCountMode.FetchAll;

Note this will force all records to be loaded thus can take some time depending on the dataset. This will be included in the next version. In the meanwhile, one workaround you can use is simply to force the loading of all records:

  AureliusDataset1.DisableControls;
  try
    Bookmark := AureliusDataset1.GetBookmark;
    while not AureliusDataset1.Eof do
      AureliusDataset1.Next;
    AureliusDataset1.GotoBookmark(Bookmark);
  finally
    AureliusDataset1.EnableControls;
  end;
  ShowMessage(AureliusDataset1.RecordCount.ToString);

Thank you , Wagner !

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.