TAureliusDataset & RecordCount

Hi,

if I set the filtered-property to true, the RecordCount-property won't change it value.
I use a grid-control which uses the RecordCount for the number of visible rows. That causes that I have the same number of rows if I filter the dataset, but the last rows appears empty.

Regards,
Michael

Hi Michael,


that's correct RecordCount is not affected by the Filtered property.

Hi Wagner,

I just compared it with the behaviour of different datasets.
RecordCount is updated if the dataset is filtered.
So that seems to be the standard-complient behaviour. Maybe you can change this?



Which other dataset have you tried? Have you checked it by filtering the dataset with OnFilterRecord event or using the Filter property. Some datasets rely on server-side filtering which allows returning the number of records. Retrieving the number of records having a dataset filtered by OnFilterRecord will require iterating through all records in dataset, and cause decrease in performance.

What I agree is that we can improve code to have the dataset to be non-sequence while filtered, meaning RecordCount will not be accessible in those cases. You can try to update Aurelius.Bind.Dataset.pas file by replacing some methods with the following code. Let me know if it solves your problem:

function TBaseAureliusDataset.GetRecordCount: integer;
begin
  if FetchingRecords or Filtered then
    Result := -1
  else
    Result := ListCount;
end;

function TBaseAureliusDataset.IsSequenced: Boolean;
begin
  Result := not FetchingRecords and not Filtered;
end;