# Historian query behaviour

**URL:** <https://forum.inductiveautomation.com/t/historian-query-behaviour/95337>\
**Category:** Ignition\
**Created:** [August 29, 2024, 6:31pm UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337 "2024-08-29T18:31:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![denny\_jimenez](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@denny\_jimenez](https://forum.inductiveautomation.com/u/denny_jimenez)\
**Post date:** [August 29, 2024, 6:31pm UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337/1 "2024-08-29T18:31:28Z")

</div>

Greetings Forum,  
I am developing a project with Ignition 8, on Windows Server 2022. As part of the project I have configured 3 string type memory tags, which I store in the historian through the SampleMode Onchange parameter. The idea is to make a script that makes a change to some part of the string and that is stored in the historian, but my inquiry is not related to the script. If I make a change to the tag, which I normally do with system.tag.writeBlocking, it is stored without problems, the tags in reference are the following:

[default]ST\_INT/Availability1  
[default]ST\_INT/Availability2  
[default]ST\_INT/Availability3

When I make a change to Availability1, I can verify through my MYSQL server that it is stored in the history, here it can be seen, stored at 12:02:33

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/54d081654f90265cf4d7cfe692a93be1e8a1fd39.png)

But when I query the history I see the other two tags as if they were stored at the same time, that is, my inquiry is related to the reason why the other two tags appear at 12:02:33. The query used and tested from the console is the following:

```python
path = ["[hist_fast]ST_INT/Availability1", "[hist_fast]ST_INT/Availability2", "[hist_fast]ST_INT/Availability3" ]
dataSet = system.tag.queryTagHistory(paths = path, startDate= startDateHist, endDate= endDateHist, returnSize = -1, aggregationMode="LastValue", noInterpolation = "TRUE")
dsPy = system.dataset.toPyDataSet(dataSet)
for itmData in dsPy:
	for y in itmData:
		print y

```

The result is the following:

Thu Aug 29 12:02:33 COT 2024  
Inverter1,2024-08-28 08:00:00,2024-08-28 10:00:00,T3  
Inverter2,2024-08-28 08:00:00,2024-08-28 13:00:00,T3  
Inverter3,2024-08-28 08:00:00,2024-08-28 13:00:00,T3

At 12:02:33 it is observed that the 3 tags were stored. Availability1, Availability2 and Availability3, which differs from what exists in the historical database seen through Mysql.  
Any help would be appreciated

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [August 29, 2024, 7:00pm UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337/2 "2024-08-29T19:00:05Z")

</div>

If you don't want it to interpolate you need to set noInterpolation on your system.tag.queryTagHistory to 1 (True)  
(Typing from memory so you might want to verify capitalization.)

---

<div class="post-metadata">

**Author:** ![denny\_jimenez](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@denny\_jimenez](https://forum.inductiveautomation.com/u/denny_jimenez)\
**Post date:** [August 30, 2024, 12:58am UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337/3 "2024-08-30T00:58:49Z")

</div>

Thanks for the reply, the only thing is that the system.tag.queryTagHistory is already with noInterpolation = "TRUE", and gives the same result.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [August 30, 2024, 12:45pm UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337/4 "2024-08-30T12:45:48Z")

</div>

Are the tags set as Discrete historical storage?  
You will also have to return them in Tall format I believe to only see the onChange for each tag separately.  
I just created 3 string tags on my test server, set their history Deadband to Discrete, storage to OnChange

Then changed the value on string1 a few times, string2 a few times, and ran the query like this

```python
taglist = ['[default]global/String1','[default]global/String2','[default]global/String3']
dataset = system.tag.queryTagHistory(taglist,startTime = system.date.addHours(system.date.now(), -1), endTime = system.date.now(), noInterpolation=1,includeBoundingValues=0,returnFormat='Tall')

```

And it returns it as you are wanting.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/4/d476bb0bb8bda18bffee29b11276a3f9cf234442.png)

---

<div class="post-metadata">

**Author:** ![denny\_jimenez](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@denny\_jimenez](https://forum.inductiveautomation.com/u/denny_jimenez)\
**Post date:** [September 3, 2024, 3:17pm UTC](https://forum.inductiveautomation.com/t/historian-query-behaviour/95337/5 "2024-09-03T15:17:17Z")

</div>

thanks @mmaynard, Tail format was the solution.
