Using queryTagHistory to retrieve data using storeTagHistory

Hi everyone,

I’ve run into problems with retrieving history data from a tag using system.tag.queryTagHistory

Here is my situation:

I need to make history of a value of a tag but it needs to be one shot based on condition so I created a value changed scripting on a tag that goes along the lines of:

if (currentValue.value > slow_cycle and previousValue.value < slow_cycle) or (currentValue.value > watchdog and previousValue.value < watchdog):
	historyprovider = 'TagHistoryDB' 
	tagprovider = 'JR219'
	paths = ['[JR219]New Instance/A']
	values = [currentValue.value]
	
	system.tag.storeTagHistory(historyprovider, tagprovider, paths, values)
	logger = system.util.getLogger(tagPath)
	logger.info('history inserted')

and when I check the TagHistoryDB, I can see that the tagpath exists in the sqlth_te. Buth when I try to retrieve the data using system.tag.queryTagHistory(['[JR219]New Instance/A']), it returns 0 rows. I tried the tag history on binding but same thing happened. I can retrieve the history of a tag that has it’s History Enabled set to true.

It would be immensely appreciated if anyone could share their thoughts on this and many thanks in advance!