Average value of a pen on an easy chart

Yeah I think the key to making it easy to work with data from split/partitioned tables is to let ignition do the work. I like the tag history binding available in tables, it makes it really easy to do simple things with historical data.

Now I just have to work out if I can somehow achieve the same thing either through scripting or expression for a numeric label.

The other thing I don’t understand is why I am getting multiple returned results in my table when I set it to a fixed sample size and average aggregation mode. Its always returning one average per day which is fine If my range is 8 hours, but when its a week it returns 7 results.

I believe this is similar or the same as using the system.tag.queryTagHistory() but what I dont understand is how to customise the time slice. If I say that I only want 1 result, thats what I want. The help file talks about a time slice but I cant see how I can customise this time slice to be the window I am trying to analyse, this is what the manual says:

"The return size determines how the underlying data is aggregated and/or interpolated. If a distinct return size is specified, that will be the number of rows in the resulting dataset. The special numbers 0 and -1 mean “Natural” and “On-Change”, respectively. “Natural” calculates a return size based on the rate of the logging historical scan classes. For example, if you query 1 hour of data for a scan class logging every minute, the natural return size is 60. “On-Change means that you’ll get an entry whenever any of the tags under consideration have changed.
The aggregation mode is used when the data is denser than what you asked for - there is more than 1 sample per time slice in the range you’re requesting. “MinMax” will return two entries per time slice - the min and the max. “Average” will return the average value of all samples in that time slice.”

If I cant get around the fact that it returns a dataset of multiple averages per time slice then I guess I will just average the column of averages with mean(dataset,column)

I must admit though, I am not having much luck scripting a table of results using system.tag.queryTagHistory()
I can get the results binding the tag history but scripting it I keep getting errors.