I'm trying to query tags for a 24h period on 1-second intervals (expecting 86400 points).
I'm working on Vision 7.9.
This same code works on 8.1.
i'm getting ~34000 data points (but that must be related to how i configured my historian). 7.9 looks like it can't do the interpolation like 8.1?
try:
dataSet = system.tag.queryTagHistory(
paths=tag_path,
startDate=startTime,
endDate=endTime,
intervalSeconds=interval_seconds, # Interpolated to 1-second intervals
returnFormat='Wide',
aggregationMode='Interpolation' # Fill in missing data points
)
pyData = system.dataset.toPyDataSet(dataSet)
except:
system.gui.errorBox("Error querying tag history. Please check your tag paths or date range.")
pyData = None # Set pyData to None to handle errors later
This is not how you turn on interpolation, and it is not a valid aggregate, the code just ignores it (well actually it tries/and fails to execute it as a custom python aggregation but I'm not sure if that is logged or it just fails silently.)
If it did throw an error, and it may, your except block would not catch it as it would be a Java Exception and not a Python Exception. You need to import java.lang.Throwable and add a catch for that to catch any Java Errors.
the noInterpolation = False has no effect - It still outputs the raw number of points. I did a one-hour range test where interval_seconds = 1. Instead of getting 3600 points, I'm only getting the raw points. no interpolation was made. I tested with IntervalMinutes and it worked. it looks like IntervalsSeconds is not available for 7.9 system.tag.queryTagHistory | Ignition User Manual