Detect a change gap on a value


I’m having values being historized, and I would like to be able to create an alarm when the value has exceeded a certain gap change over a given period of time.

For example, if the current value is more than 10% higher than the value one minute ago.

I’m using a Vision Client to make some tests:

I’m trying to use the script function system.tag.queryTagHistory
And I’m expecting to get the current value and the value one minute ago:

dateFin =
dateDebut =, -intervalleTemps)

results = system.tag.queryTagHistory(paths=[tagPath],

results = system.dataset.toPyDataSet(results)

event.source.parent.getComponent(‘txtAncienneDate’).text = str(results[0][0])
event.source.parent.getComponent(‘txtNouvelleDate’).text = str(results[1][0])

event.source.parent.getComponent(‘numAncienneValeur’).floatValue = results[0][1]
event.source.parent.getComponent(‘numNouvelleValeur’).floatValue = results[1][1]

The issue is, even though I set noInterpolation=True, the value from one minute ago still grows with time (it’s being time-interpolated).

How can I get the exact history value from a certain amount of time in the past without interpolation ?

Thanks !