queryTagHistory Getting Wrong Values

Hi, I'm trying to get a dataset with values from a historical tag using queryTagHistory(). The concept is that once the user selected the two dates (range), and then click on "Get Data", the data will be displayed on the table. The problem is that the values on the "first shift efficiency" column are wrong. In the example bellow you can see that the value at 1/28/2023 1:00pm should be 40.44 but the dataset has 47.66 instead.

Comparing values with chart.

Script in the button.

Tag history settings:

Are the values misaligned? I've seen similar posts in the forum before.

Correct, the values are misaligned by one. A bug?

Seems to be. When I first encountered somebody talking about this in the forum, I set up an experiment, and I found that I was able to independently replicate the problem. I'm not sure if anybody got around to reporting it or if IA has any kind of ticket open on this problem, but since nobody has responded as such, the proper course of action would be to get official support involved, and it would be great if you could report back what you find out from them for future reference in the forum.

2 Likes

I had an issue in my perspective app where the time was including milliseconds and causing my table to show different values every time I loaded it.

So I was setting the start and stop times with 0 for the minutes. I found that I had 3 values at the minute time with 3 different values. because of millisecond points. Not sure this is your issue, but zeroing out the milliseconds value help fox my issue.

Date entry:

Strip millis:

Update db dates:

Shows full date/time with ms at 0:
image