(19.09.2022, 07:28)Daniel Wrote: https://forum.logicmachine.net/showthrea...7#pid17347
thanks Daniel for the pointer.
(19.09.2022, 08:15)admin Wrote: Another option is to use storage.
1. Event script to accumulate the values:
Code:value = event.getvalue() key = 'average' storage.exec('incrbyfloat', key .. ':acc', value) storage.exec('incr', key .. ':cnt')
2. Scheduled script to calculate the average and reset the accumulated values:
Code:key = 'average' acc = storage.get(key .. ':acc', 0) cnt = storage.get(key .. ':cnt', 0) avg = 0 if cnt > 0 then avg = acc / cnt end grp.update('1/1/1', avg) storage.delete(key .. ':acc') storage.delete(key .. ':cnt')
thank you very much, I shall try this too.