Recent

Author Topic: How to count records from a filtered TBufDataset?[SOLVED]  (Read 4612 times)

hrayon

  • Full Member
  • ***
  • Posts: 118
How to count records from a filtered TBufDataset?[SOLVED]
« on: March 27, 2014, 02:41:44 am »
How to get the affected number of records from a TBufDataset after applying a filter? RecordCount always returns everything, with or without filter.
Thank you.
« Last Edit: March 27, 2014, 11:59:35 pm by hrayon »

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: How to count records from a filtered TBufDataset?
« Reply #1 on: March 27, 2014, 09:11:36 am »
something like this:
Code: [Select]
function FilterRecordCount(dataset : TDataset) : integer;
begin
  try
    result := 0;
    dataset.disablecontrols;
    dataset.first;
    while not dataset.eof do
    begin
       result := result + 1;
       dataset.next
    end;
  finally
    dataset.enablecontrols;
  end;
end;
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

hrayon

  • Full Member
  • ***
  • Posts: 118
Re: How to count records from a filtered TBufDataset?[SOLVED]
« Reply #2 on: March 28, 2014, 12:06:10 am »
It worked, thank you. I find it strange about the field absence or property with that value, since probably when applying the filter, the dataset is traversed.

 

TinyPortal © 2005-2018