# New seems to have reviealed a bug in a scripting function

**URL:** <https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [January 4, 2022, 3:02am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624 "2022-01-04T03:02:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [January 4, 2022, 3:02am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624/1 "2022-01-04T03:02:27Z")

</div>

```auto
	endTime = system.date.now()
	startTime = system.date.addHours(endTime, -1440)
	status = system.tag.queryTagHistory(["[default]" + unit + "/Status"], startDate = startTime, endDate = endTime, ignoreBadQuality = True)

```

So if that code spans the year threshold it cuts off everything after the new year.Thx, jake

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 4, 2022, 5:58am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624/2 "2022-01-04T05:58:21Z")

</div>

Doubt it, try:

```auto
status = system.tag.queryTagHistory(paths=["[default]" + unit + "/Status"], startDate = startTime, endDate = endTime, ignoreBadQuality = True)

```

Do you actually have data before new year (check db) ? Is prune enabled? Is your path correctly typed?

Share output for status variable

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [January 4, 2022, 6:38am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624/3 "2022-01-04T06:38:27Z")

</div>

yes, no prune, path good. An arc script arced 12 2021 instead of 12 2020. I’m importing the arc now and retesting, I’ll let you know how it goes, but the query didn’t seem to pull any jan data, it did november, nothing from dec as expected without that months data.Thx, jake

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 4, 2022, 6:51am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624/4 "2022-01-04T06:51:38Z")

</div>

Maybe your gateways pc has a lag in time (a year lag?). What do you see with `system.date.now()`

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [January 12, 2022, 2:52am UTC](https://forum.inductiveautomation.com/t/new-seems-to-have-reviealed-a-bug-in-a-scripting-function/54624/5 "2022-01-12T02:52:01Z")

</div>

We were missing a table in the historian which caused all data after the missing month not display, all is well now
