@bill65358 This appears to be simple enough in terms of the data that you want to display that you could use an aggregate query to populate the repeater. You could put both functions in your onReady something like this:
$w.onReady(function () {
$w('#repeater').onItemReady(($item, itemData, index) => {
$item('#count').text = itemData.count;
$item('#title').text = itemData.name;
});
$w("#filter").onClick((event) => {
const from = $w('#fromDate').value;
const to = $w('#toDate').value;
const filter = wixData.filter().between("_createdDate",from,to);
wixData.aggregate('tutorial_logs')
.filter(filter)
.group("name")
.count()
.run()
.then((results) => {
console.log("results",results);
$w("#repeater").data = results.items;
$w("#repeater").show();
});
})
});
Be sure to check out the console log to inspect the array that the aggregate function returns. You may need to alter the code some. The aggregate function will return one record for each name as a result of the group function, and a count of the number of times that the name is in the collection.
For future reference, it’s not considered good practice to make multiple calls for data in repeater looping functions. It will cause the repeater to load a lot more slowly. Nor from a security standpoint, is it advisable to have queries in your page code but rather in backend functions. I’m doing it here for simplicity’s sake in order suggest a way to solve the the problem at hand.