system.tag.queryTagHistory(paths, startDate, endDate, returnSize, aggregationMode, returnFormat, columnNames, intervalHours, intervalMinutes, rangeHours, rangeMinutes, aggregationModes, includeBoundingValues, validateSCExec, noInterpolation, ignoreBadQuality)
PySequence paths - An array of tag paths (strings) to query. Each tag path specified will be a column in the result dataset.
Date startDate - The earliest value to retrieve. If omitted, 8 hours before current time is used.
Date endDate - The latest value to retrieve. If omitted, current time is used.
Integer returnSize - The number of samples to return. -1 will return values as they changed, and 0 will return the "natural" number of values based on the logging rates of the scan class(es) involved. -1 is the default.
String aggregationMode - The mode to use when aggregating multiple samples into one time slice. Valid values are: "Average" (time-weighted), "MinMax", "LastValue", "SimpleAverage", "Sum", "Minimum", "Maximum", "DurationOn", "DurationOff", "CountOn", "CountOff", "Count", "Range", "Variance", "StdDev", "PctGood", and "PctBad". Default is "Average" (time-weighted).
String returnFormat - Use "Wide" to have a column per tag queried, or "Tall" to have a fixed-column format. Default is "Wide".
PySequence columnNames - Aliases that will be used to override the column names in the result dataset. Must be 1-to-1 with the tag paths. If not specified, the tag paths themselves will be used as column titles.
Integer intervalHours - Allows you to specify the window interval in terms of hours, as opposed to using a specific return size.
Integer intervalMinutes - Same as intervalHours, but in minutes. Can be used on its own, or in conjunction with intervalHours.
Integer rangeHours - Allows you to specify the query range in hours, instead of using start and end date. Can be positive or negative, and can be used in conjunction with startDate or endDate.
Integer rangeMinutes - Same as rangeHours, but in minutes.
PySequence aggregationModes - A one-to-one list with paths specifying an aggregation mode per column.
Boolean includeBoundingValues - A boolean flag indicating that the system should attempt to include values for the query bound times if possible. See Seeded Values for more information.
Boolean validateSCExec - A boolean flag indicating whether or not data should be validated against the scan class execution records. If false, data will appear flat (but good quality) for periods of time in which the system wasn't running. If true, the same data would be bad quality during downtime periods.
Boolean noInterpolation - A boolean flag indicating that the system should not attempt to interpolate values in situations where it normally would. This will also prevent the return of rows that are purely interpolated.
Boolean ignoreBadQuality - A boolean flag indicating that bad quality values should not be used in the query process. If set, any value with a "bad" quality will be completely ignored in calculations and in the result set.
Integer timeout - Timeout in milliseconds for Client Scope. This property is ignored in the Gateway Scope. [optional]
Dataset - A dataset representing the historian values for the specified tag paths. The first column will be the timestamp, and each column after that represents a tag.
All
3 Comments
Anonymous
Make sure to use the Historical Tag Provider name and not the Realtime Tag Provider name if calling this function globally!
Anonymous
Hi.
Where can i found historical tag provider?? i am trying and i can not read data from the tag, all data is 0 rows.
Anonymous
Hello.
I found the solution myself, on tag path you must insert the tag path (normal from tag browser) and before the historycal data provider, for example.
system.tag.queryTagHistory(paths=["[HISTORY_DB]Directory1/Directory2/tag3"]) will return all the records.