Page 1 of 1

Filtered and Real Record Count?

Posted: 01.04.2013, 17:27
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

Posted: 02.04.2013, 08:03
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

Posted: 11.04.2013, 21:41
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;

Posted: 16.04.2013, 19:45
by ism
For correct RecordCount try

Query.FetchAll

or

Query.Last
Query.First

Posted: 17.04.2013, 22:11
by IbeDBob
Thanks, I will give that a try.