# 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:** 33

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [October 11, 2024, 7:08pm UTC](https://forum.inductiveautomation.com/t/best-way-to-script-from-tag-history-not-using-vision/97095/33 "2024-10-11T19:08:03Z")

</div>

There are a couple of good posts on comparisons of Gateway Events vs Tag Events on the forum, with (my) most-notable thread:

> [@Difference Gateway Event vs Tag Event Scripts](https://forum.inductiveautomation.com/t/difference-gateway-event-vs-tag-event-scripts/63191/2):
>
> There are differences, but your conclusions are the opposite of what you might find. Both mechanisms will never miss a tag change event delivered by the tag system. A gateway event tag change script has an unbounded queue to hold and execute these change events. You won’t ever miss events, but it’s technically possible to run your memory up if your script execution blocks for a long time, or indefinitely, as events continue to queue up. Tag event scripts have a bounded queue, per-tag, size 5,…

Taking above advice into consideration, and reading:

> [@Joe\_Alcide](#):
>
> There is a script that puts a value in this tag every hour.

I would:

1. Change 'this tag' to a dataset tag.
2. Modify the existing script to append/insert the value to 'this tag' as a dataset.

then, either:

- Add another expression tag, utilizing mean(dataset, columnIndex) expression.
- Modify the existing script to calculate a new mean from the latest 12 values, and store that value (and last 11 historical calcs) in another column of the same dataset.

---

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