Counting the number of items in repeater

Hi guys,

I am trying to provide a total count of items in the repeater but I also set the number of items to display through the dataset and then a button to load more items. I am struggling to get a total count not just the count of the max items it loaded in the first run. I set the number of items to display to 12, so when I use the code below, and I have more than 12 items to show, it will give me 12 until I load more items. any way to get the number in the first place?

$w("#text1").text = $w("#repeater1").data.length.toString();

Thanks,
Tamir

Hi Tamir,

If you want the total count of items on a dataset connected to a repeater, you can use the getTotalCount() method on the dataset.

Here’s a example of how it can be used:

const totalCount = $w("#repeaterDataset").getTotalCount();

Thanks Thomas! From some reason it gave me an error message when I used the getTotalCount().
I ended up query the data collection and then using the length attribute of the results from the query.