RecordCountAll: Integer;
The RecordCountAll property returns total quantity of records in a data source, that can be placed to cache.
On obtaining the value of this property all records of data source are loaded into cache.
Executing the example requires two tables with the Table_1 and Table_2 identifiers in repository.
Sub Main;
Var
MB: IMetabase;
DSInst, DSInst1: IDatasetInstance;
Cache, Cache1: ICachedDataset;
Begin
MB := MetabaseClass.Active;
DSInst := MB.ItemById("Table_1").Open(Null) As IDatasetInstance;
DSInst1 := MB.ItemById("Table_2").Open(Null) As IDatasetInstance;
Cache := DSInst.OpenCached;
Cache1 := DSInst1.OpenCached;
Cache.IndexFields := "FIELD2";
Cache.MasterFields := "FIELD_2";
Cache.MasterSource := Cache1;
Cache1.First;
While Not Cache1.Eof Do
Debug.WriteLine(Cache.RecordCountAll);
Cache1.Next;
End While;
End Sub Main;
After executing the example, two tables are connected. The field of the main table from which the data is taken has the FIELD_2 identifier; the field of the dependent table, by which filtering according to data from the first table is performed, has the FIELD2 identifier. All records of the main table will be checked. Quantity of records in the linked table, received as a result of filtering by data of each record of the main table, is displayed in the console.
See also: