Historian query behaviour

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

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:

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

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.)

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

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

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

1 Like

thanks @mmaynard, Tail format was the solution.