system.tag.queryTagCalculation not returning my actual minimum and maximum

Good morning everyone,
I’ve recently been stumped by a problem and I am hoping someone else can offer me some insight into it.

I have a database which stores all my analog values. I need to pull the minimum and maximum from those values for given times. I have attached a .csv file with the actual values in the database for reference.

My problem is I am trying to get the minimum and maximum value for the Well Pump 1 Hours column between 10/22 6:00am and 10/23 6:00am. To do this I use the function system.tag.queryTagCalculation like this:

tagPaths = ['Well Pump 1/Words/H_TOTAL']
calcs = ['Minimum', 'Maximum', 'Range']
startTime = event.source.parent.getComponent('Date Range').startDate
endTime = event.source.parent.getComponent('Date Range').endDate

event.source.parent.getComponent('Table').data = system.tag.queryTagCalculations(paths=tagPaths, calculations=calcs,startDate=startTime,endDate=endTime)

However the query returns 973.0 as the minimum instead of the expected 969.69. When I do a tag historian query using the same start and end time I get the attached CSV file.

Any ideas?


KM_Data_2019-10-20.csv (37.8 KB)

Any possibility it’s an artifact of how you’re displaying the number? (i.e. displaying with one decimal place)

Possibly. How could I test that?

Go into the table customizer (right-click on the table component) and check the numberformat strings.

In the attached screen shot, the first two columns of the table are formatted to show up to two decimal places while the last column is formatted to show up to one decimal place. (## vs #)


Thank you for the response. They are all set to display to two decimal places. I also took a look at the raw data returned by the function (before it is displayed in the table) and it returns the same thing just to a greater precision.