I have a page with 2 tables; the first one shows individual results by being connected to a collection and the second one I would like to display an aggregate of the first table for a specific person, so it should only be one row. When I run my aggregation, nothing shows in the table. Here is my code:
import wixData from 'wix-data';
$w.onReady(() => {
Sum_amount();
});
export function Sum_amount(){
let currentItem = $w('#dynamicDataset').getCurrentItem();
let currentmember = currentItem.memberid;
let having = wixData.filter().eq("member",currentmember)
wixData.aggregate("TxResults")
.having(having)
.sum("totalpts","totPts")
.run()
.then( (results) => {
$w('#table2').rows = results.items;
});
}