Filtered and Real Record Count?

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
IbeDBob
Junior Boarder
Junior Boarder
Posts: 47
Joined: 27.05.2010, 21:04

Filtered and Real Record Count?

Post by IbeDBob »

Hi,

D5 and v6 Zeos.

I'd like to know the actual RecordCount of a DataSet.

If it is Filtered then RecordCount only returns the available records as Filtered.

TDbf has an ExactRecordCount which always shows the total Records regardless of Filtering or Indexes.

Does Zeos have anything like that?

I want to use...

Label1.Caption:=IntToStr(tbl1.RecordCount)+' of '+
IntToStr(tbl1.TotalRecordCount);

Possible?

Thanks
Thanks

Dyslexic Bob
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Post by marsupilami »

Hello IbeDBob,

I don't know if Zeos Datasets do have this special ability. But you could always save the record count into some kind of a variable or in the Tag property in the AfterOpen event, before filtering the records.

Best regards,

Jan
IbeDBob
Junior Boarder
Junior Boarder
Posts: 47
Joined: 27.05.2010, 21:04

Post by IbeDBob »

Thanks Jan,

But that would only be true when the file is opened. If the user adds or deletes records then it will not work.

I am getting around it for the time being with a query, this may be useful for others as it ignores any filtering etc...

Code: Select all

function GetAllRecCount : String;
begin
  qryStock.Close;
  qryStock.SQL.Clear;
  qryStock.SQL.Add('SELECT * FROM tblStoc';
  qryStock.ExecSQL;
  qryStock.Open;
  Result:=IntToStr(qryStock.RecordCount);
  qryStock.Close;
end;
Thanks

Dyslexic Bob
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

For correct RecordCount try

Query.FetchAll

or

Query.Last
Query.First
Lazarus 1.0.8 fpc 2.6.0
IbeDBob
Junior Boarder
Junior Boarder
Posts: 47
Joined: 27.05.2010, 21:04

Post by IbeDBob »

Thanks, I will give that a try.
Thanks

Dyslexic Bob
Post Reply