Quering Tag History Return One record after the endData

Hi, I'm trying to fetch data by perspective tag history binding. Although I set "As Stored" Query Mode with fixed begin date and end date the results set always returns the next record after the end date.
Here are the settings:

This is the result:

And this is the raw data in the database (in reverse time order):

I played with system.tag.queryTagHistory with the following parameters:
ds = system.tag.queryTagHistory(
paths = paths,
startDate = value.begin,
endDate = value.end,
aggregationMode = "LastValue",
ignoreBadQuality = True ,
returnFormat = "Tall",
includeBoundingValues = False,
returnSize = -1,
noInterpolation = True,
But this give the same results.

I'm wondering if Ignition returns this additional records by design or I miss something. I just need to fetch the records with timestamps later than beginDate and earlier than endData.

By design, IIRC. Ignition is trying to satisfy your complete datetime span. This may be affected by the deadband mode--Analog mode is more complicated and may require this.

Thanks for the fast reply Phil. The dead band is set to Discrete.
I'll use the queryTagHistory() function and then remove the last record. But it still seems strange to me - this additional record should be optional (when includeBoundingValues is set). Otherwise, If I request the records from 10:00:00 to 10:59:59 o'clock I'll also get the next record which might be at 11:05:03 or a day after. It means that I can't show the raw records for a given time period in a table without coding.

1 Like