# Best Way to Script from Tag History NOT using Vision

**URL:** <https://forum.inductiveautomation.com/t/best-way-to-script-from-tag-history-not-using-vision/97095>\
**Category:** Ignition\
**Tags:** vision, scripting\
**Created:** [October 10, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/best-way-to-script-from-tag-history-not-using-vision/97095 "2024-10-10T17:01:25Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 10, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/best-way-to-script-from-tag-history-not-using-vision/97095/20 "2024-10-10T19:13:38Z")

</div>

> [@amarks](#):
>
> what would be the "official" recommendation for querying data from the tag historian for use in a tag?

Well, depends on what you want to do with the data. In this case, since it seems that the end goal is to get an average, I would probably recommend `system.tag.queryTagCalculations()`.

A tag history binding on the table might also be acceptable.

For reference:

> [@History tag - writing data to wrong table](https://forum.inductiveautomation.com/t/history-tag-writing-data-to-wrong-table/97075/2):
>
> The only supported way to query data out of the historian is via Ignition, and we will automatically bridge across as many tables as needed.

> [@amarks](#):
>
> Considering that Joe only wants to go back 12 hours

It isn't just 12 hours once though, its the _last_ 12 hours. Which to me means that it is rolling, and so unless partitioning is off completely, at some point the query will break.

---

_[View the full topic](https://forum.inductiveautomation.com/t/best-way-to-script-from-tag-history-not-using-vision/97095)._
