# Reports, Data Tag Historian vs system.tag.queryTagHistory()

**URL:** <https://forum.inductiveautomation.com/t/reports-data-tag-historian-vs-system-tag-querytaghistory/64375>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [September 22, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/reports-data-tag-historian-vs-system-tag-querytaghistory/64375 "2022-09-22T15:51:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Travis.Dreier](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Travis.Dreier](https://forum.inductiveautomation.com/u/Travis.Dreier)\
**Post date:** [September 22, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/reports-data-tag-historian-vs-system-tag-querytaghistory/64375/1 "2022-09-22T15:51:27Z")

</div>

I noticed that when using Tag Historian Query data source if at tag that did not have a value change within the start and end binding it will contain the value stored out side of the date range.

When using a script data source and below tag to query the tag value I get a null value if there is no data stored within the time range.

system.tag.queryTagHistory(paths=tagPath, startDate=data[‘StartDate’], endDate=data[‘EndDate’], retrunSize= 1000 ,aggregationMode=“MinMax”, columnNames=dataKeyAlias,returnFormat=‘Wide’)

Is there a way to use the script data source but get the same output as the Tag Historian Data source?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 22, 2022, 4:23pm UTC](https://forum.inductiveautomation.com/t/reports-data-tag-historian-vs-system-tag-querytaghistory/64375/2 "2022-09-22T16:23:03Z")

</div>

I think you need to set `includeBoundingValues`.  
See the docs, [system.tag.queryTagHistory - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.tag.queryTagHistory)

---

<div class="post-metadata">

**Author:** ![Travis.Dreier](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Travis.Dreier](https://forum.inductiveautomation.com/u/Travis.Dreier)\
**Post date:** [September 23, 2022, 3:27pm UTC](https://forum.inductiveautomation.com/t/reports-data-tag-historian-vs-system-tag-querytaghistory/64375/3 "2022-09-23T15:27:16Z")

</div>

@jlandwerlen thanks for pointing that out.

Tuning on includeBoundingValues changes the problem as the t\_stamp that gets pulled in from the date that the tag change takes place. This causes the time series chart to display a duration greater than my desired start and end time.

I may need to add a step to go through the history and update the t\_stamp to startDate if older than startDate.
