I’m having some issues creating custom historian aggregates. What I want to do is get the average for a days worth of historical data, but omit any 0 values from the average. I’m new to Ignition and scripting, and am having trouble understanding the example in the manual:
It would help if I knew what to expect from the example given. When I run the example code with interpolation off I get:

Shouldn’t I be getting a single value of cnt back from the function that represents the number of good quality rows? Instead I get a table of data with 0s in it for every time stamp.
Is your historian module actively licensed? Are there any errors in the gateway logs?
Historian is licensed. When I execute the script it shows no errors, but the gateway logs do show an error:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File “”, line 2, in pyaggimpl NameError: global name ‘shared’ is not defined

Where do you have your aggregate script defined? Is it in a lib called literally shared
or something similar? Is it set as your gateway scripting project( I don’t know if that’s documented but I think might be required).
I believe I have it in the right place.
Is it set as your gateway scripting project?
This was the issue. I misunderstood the gateway scripting in the instructions. Thanks for pointing it out.