Hello All,
Please help I just can't see where I am going wrong?
I have collected data in a dataset called 'ratings'. In Ratings I have 4 fields - Rating Number, Organisation, Title, Module.
I am looking to calculate an aggregate of the ratings on a dynamic organisation or dynamic Module item page that calculates just the ratings filtered by Organisation Name and Module Text and the have the values connected to two inputs - a number and a Progress Bar. (i.e. Showing the 'Access' (Title) with rating '1' (rating)for 'Royal Life Saving'(OrganisationName) in 'Supervision Planning'(Module Text) and 'Supervisor' with rating 5 for Royal Life Saving in Supervision Planning.
Here is my code on a Dynamic Organisation item page:
import wixData from 'wix-data'; const filter = wixData.filter().contains("dynamicDataset", "title"); const filter = wixData.filter().contains("moduleDataset", "title"); $w.onReady(() => { Sum_amount(); }); let having = wixData.filter().contains("moduleDataset", "title") export function Sum_amount() { wixData.aggregate("Ratings") .filter(filter) .group("moduleText") .having(having) .sum("rating", "sumrating") .run() .then((results) => { $w('#input2').value = results.items[0].sumrating; //display total in input field at bottom of table $w('#progressBar3').value = results.items[0].sumrating; //display total in input field at bottom of table }); }
@Yisrael (Wix) ?