Hi Phillip,
In this vein I added a PointValueQuery object into scripting environments. It will enable you to do this task like,
//Sum the max value from the data, rolled up into 1 days periods // With no quantizing the rollup period! If you want it to start at // the 0th second of the day you need to set the start time as such. var now = new Date().getTime(); var then = now - 86400000*20; total = 0; var callback = function(val) { total += val; }; //Query point with ID=1, could use p.getDataPointWrapper().getId() // for a context point var dataPointIds = [1]; //Twenty days of 1-day-maximum rollup, using ALL the whole statistics object is passed to the callback PointValueQuery.rollupQuery(dataPointIds, then, now, callback, MAXIMUM, 1, DAY); //print(total); return total;There is also just a query() method for getting a stream of raw values in time order from some number of data points. This utility will be available in the next Core release. Here's the git issue: https://github.com/infiniteautomation/ma-core-public/issues/1234