Hi JoHn-Beer,
It sounds like a time to use the PointValueQuery.
var endDate = CONTEXT.getTimestamp();
var startDate = endDate - CONTEXT.millisInPast(DAY, 30); //handles DST shenanigans
var results = [];
var callback = function(idValueTime) {
results.push(idValueTime);
};
var pointsToQuery = [ p1.getDataPointWrapper().getId() ];
PointValueQuery.rollupQuery( pointsToQuery, startDate, endDate, callback, LAST, 1, DAY);
print(results);
//Do want you want now with the results, or in the callback function
Run on cron 0 0 8 * * ?