# system.tag.queryTagHistory "Range" aggregationMode does not work as described in documentation

**URL:** <https://forum.inductiveautomation.com/t/system-tag-querytaghistory-range-aggregationmode-does-not-work-as-described-in-documentation/65243>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [October 14, 2022, 5:49pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-range-aggregationmode-does-not-work-as-described-in-documentation/65243 "2022-10-14T17:49:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Webb](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@Daniel\_Webb](https://forum.inductiveautomation.com/u/Daniel_Webb)\
**Post date:** [October 14, 2022, 5:49pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-range-aggregationmode-does-not-work-as-described-in-documentation/65243/1 "2022-10-14T17:49:32Z")

</div>

> endTime = system.date.now()  
> startTime = system.date.addSeconds(endTime, -500)  
> ds = system.tag.queryTagHistory(paths=['[XOM]Testing/MyTag']\*5, startDate=startTime, endDate=endTime, aggregationModes=['Count', 'LastValue', 'Minimum', 'Maximum', 'Range'], returnFormat='Wide', intervalMinutes=1, ignoreBadQuality=False)  
> print system.dataset.toCSV(ds, showHeaders = True, forExport = False)

"t\_stamp","Testing/MyTag","Testing/MyTag1","Testing/MyTag2","Testing/MyTag3","Testing/MyTag4"  
"2022-10-14 12:17:49.455","1.0","7.699999809265137","7.699999809265137","7.699999809265137","0.0"  
"2022-10-14 12:18:49.455","0.0","8.042443722618929","8.042443722618929","8.042443722618929","8.042443722618929"  
"2022-10-14 12:19:49.455","0.0","8.271393443502202","8.271393443502202","8.271393443502202","8.271393443502202"  
"2022-10-14 12:20:49.455","0.0","8.500343164385473","8.500343164385473","8.500343164385473","8.500343164385473"  
"2022-10-14 12:21:49.455","0.0","8.729292885268746","8.729292885268746","8.729292885268746","8.729292885268746"  
"2022-10-14 12:22:49.455","1.0","8.800000190734863","8.800000190734863","8.800000190734863","0.0"  
"2022-10-14 12:23:49.455","0.0","9.41504072952117","9.41504072952117","9.41504072952117","9.41504072952117"  
"2022-10-14 12:24:49.455","0.0","9.77871898247454","9.77871898247454","9.77871898247454","9.77871898247454"  
"2022-10-14 12:25:49.455","1.0","9.899999618530273","9.899999618530273","9.899999618530273","0.0"

The documentation:

[https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagHistory](https://docs.inductiveautomation.com/display/DOC80/system.tag.queryTagHistory)

says:

> "Range" - the difference between the min and max

However, you can see above that this is not always true. For query results between values, the Range is returning the interpolated value, but it should be 0.0 according to the documentation.

---

<div class="post-metadata">

**Author:** ![plo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/plo/32/33875_2.png) [@plo](https://forum.inductiveautomation.com/u/plo)\
**Post date:** [November 8, 2022, 10:25pm UTC](https://forum.inductiveautomation.com/t/system-tag-querytaghistory-range-aggregationmode-does-not-work-as-described-in-documentation/65243/2 "2022-11-08T22:25:10Z")

</div>

Hello Daniel\_Webb,  
What version of Ignition are you using? And how do you have your Tag History configured for your  
[XOM]Testing/MyTag tag?

I've tested on 8.1.21 with my tag storing data every second. And the Range aggregation mode works as expected.
