Top  | Previous | Next

system.tag.queryTagHistory

Description

Issues a query to to the SQLTags Historian. Querying tag history involves specifying the tags and the date range, as well as a few optional parameters. The SQLTags historian will find the relevant history and then interpolate and aggregate it together into a coherent, tabular result set.

 

This function takes a list of strings, where each string is a tag path, like "Tanks/Tank5" or "[OracleProvider]Sump/Out2". See also: Tag Paths.

 

The return size determines how the underlying data is aggregated and/or interpolated. If a distinct return size is specified, that will be the number of rows in the resulting dataset. The special numbers 0 and -1 mean "Natural" and "On-Change", respectively. "Natural" calculates a return size based on the rate of the logging historical scan classes. For example, if you query 1 hour of data for a scan class logging every minute, the natural return size is 60. "On-Change means that you'll get an entry whenever any of the tags under consideration have changed.

 

The aggregation mode is used when the data is denser than what you asked for - there is more than 1 sample per time slice in the range you're requesting. "MinMax" will return two entries per time slice - the min and the max. "Average" will return the average value of all samples in that time slice.

 

information2 This function accepts keyword-style invocation. See also: Functions / Keyword Invocation

Syntax

system.tag.queryTagHistory(paths, startDate, endDate, returnSize, aggregationMode, returnFormat, columnNames)

Parameters

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. Must be one of "Average" or "MinMax".

String returnFormat - Use "Wide" to have a column per tag queried, or "Tall" to have a fixed-column format. Default is "Wide".

PySequence columnNames

Returns

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.

Scope

All