Max history value

I’m trying to find the time that a tag reached it’s max value.

Using system.tag.queryTagHistory(…) I think I can get the max value, but I can’t seem to find an easy way to find out the exact time it was as that value.

I need that time so that I can find what a number of other tags were at the same time.

eg: (contrived example follows) I want to find what time during the day the tank was at it’s fullest. I also need to know what the inflow and out flow rates were at that same time.

Maybe it’s just to late on a Friday to think clearly.

I’m not using the historian function, but doesn’t the return dataset from that function have the timestamps in it? If so, couldn’t you call system.dataset.sort on it, sort by values, then pull the timestamp field from the first value?

I was hoping that the the system would do that.

I didn’t think of sorting the returned set. That should work.