Hi,
I have a test gateway that I am using to see how my one of my report scripts run with production gateway data. This test gateway is copy of a production gateway, so all its tags were imported with the project as well as the tag history.
When I run System.tag.queryTagHistory()
to test the data grab:
start = system.date.parse('April 1, 2025 00:00','MMMM dd, yyyy hh:mm')
end = system.date.parse('April 30, 2025 00:00','MMMM dd, yyyy hh:mm')
path = '[EHS]EHS/B2 Permit/Incoming Water/CH00243/Total'
history =system.tag.queryTagHistory([path],startDate=start, endDate= end, ignoreBadQuality=True,noInterpolation=True)
print(history.getRowCount())
I get a row count of 0.
However, when I search for the same tag path '[EHS]EHS/B2 Permit/Incoming Water/CH00243/Total'
in the sqlth_te
table I find 3 tags:
I then go and check that see if any of the IDs associated to the tagpath have data in the table sqlt_data_1_2025_04
. Of the 3 IDs associated with the tag path, only one has data in the table, this being ID 1951.
So I am sure the data is present in the system, and so something is happening when I try to grab it.
This situation is the same across all the tags. There are 3 IDs per tag path, with only one of them, the second one, having data.
Things I've tried to fix this:
-
Setting the newest ID to retired in the
sqlth_te
table so that the second tag will be referenced when calling thesystem.tag.queryTagHistory()
. This did nothing. -
Change the SCID of the row that has the ID corresponding to data to the SCID that corresponds the newest ID for the tag of interest. This did nothing.
-
Change the SCID of the row that corresponds the newest ID to the SCID that corresponds the row that contains the ID that has data in
sqlt_data_1_2025_04
. This did nothing.
I am not sure where to go from this point. I was attempting to use this as reference: Ignition Database Table Reference
so that I could manipulate the system to access the correct ID and/or partition for a tag, but I can't seem to figure it out.
Any suggestions? Thank you