getTotalCount( )
Returns the number of items in the dataset that match its filter criteria.
Description
Calling getTotalCount()
on a write-only dataset causes an error.
Note:
A dataset needs to load its data before you call its
getTotalCount()
function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you callgetTotalCount()
inside the page’sonReady()
event handler, the dataset might not be ready yet.To call
getTotalCount()
as soon as possible after a page loads, use the dataset'sonReady()
function inside the page’sonReady()
event handler to ensure that both the page and the dataset have finished loading.
Syntax
function getTotalCount(): number
getTotalCount Parameters
This function does not take any parameters.
Returns
The number of items in the dataset that match its filter criteria.
Return Type:
Was this helpful?
1let count = $w("#myDataset").getTotalCount(); // 23
1$w.onReady( () => {2 $w("#myDataset").onReady( () => {3 let count = $w("#myDataset").getTotalCount(); // 2345 } );67} );