QueryRecCount

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

QueryRecCount

Declaration

function QueryRecCount: LongInt;

Description

Extracts the number of records contained in the current query subset.

Return Value

The record count. The number of records returned is calculated in the following order.

1. If there is a fully optimized query and/or scope bitmap present, the function very quickly returns the number of records in the subset. Deleted records are included in the count.

2. If there is no query or scope bitmap set and the controlling index is not a conditional index and there is no standard filter set, this function returns the total number of records in the table (same as RecCount). Deleted and filtered records are included in the count.

3. If the controlling index is a conditional index the number of keys in the conditional index is returned. This number includes deleted and filtered records.

4. If there is a partially optimized bitmap present or a standard filter, the number returned is the actual count of records. Deleted and filtered records are excluded from the count (same as Count). The function must evaluate every record represented in the bitmap (or even in the entire table if no part of the query was optimized). In this case it can be slow.

Delphi Example

// Display table info

with ApTbl do

begin

 Edit1.Text := BaseDate; 

 Edit2.Text := IntToStr( RecSize ); 

 if FilterOn then 

         Text3.Text := QueryRecCount

 else 

         Text3.Text := RecCount; 

end;

C++Builder Example

// Display table info

Edit1->Text = ApTbl->BaseDate();

Edit2->Text = IntToStr( ApTbl->RecSize() );

if (bFilterOn)

 Text3->Text = ApTbl->QueryRecCount();

else

 Text3->Text = ApTbl->RecCount; 

See Also

CountCount, FilterDlgFilterDlg, QueryQuery, QueryTestQueryTest, RecCountRecCount, SQL COUNT!JumpID(`APOLLOSQL.HLP',`COUNT')