<< Click to Display Table of Contents >>
Internal Query Tools |
A Query tool provides an easy way to perform queries to data from a Storage.
When users start configuring a Query in an application that contains a Storage, this object is added to the list of available databases for queries. This is because Storage acts as a new data provider, making it easy for users to search for data on temporal tables.
However, users can also perform queries directly on the original database, according to the table formats previously mentioned. The disadvantage of this procedure is that this query process is more complex.
Therefore, once a Storage is selected as a data provider for a Query, its configuration interface presents some differences, as seen on the next figure.
Query window of a Storage
The available options on the Fields tab are described on the next table.
Available options on the Fields tab
Option |
Description |
---|---|
Allows selecting a function to consolidate data. Please check the next table for more information about the available functions in this option |
|
Select fields to query |
Allows selecting a Field or Fields to view on the resulting Query |
Columns |
Allows selecting the Field corresponding to each result's column, according to the selection in the previous option |
Title |
Allows specifying a title for the selected column |
Allows specifying a filter for data returned by a Query's column. For more information about the format of a filter, please check topic Usage |
|
Include BAD quality |
Allows indicating whether data with bad quality is included in the result. This option corresponds to Query's IgnoreQuality property linked to the Storage |
The available functions to consolidate data in the Functions option are described on the next table.
Available functions to consolidate data
Function |
Description |
---|---|
LastValue |
Returns the last stored data on the database |
Returns a stored value relative to a certain time instant defined in the TimeStamp variable. The type of relation, defined in Query's FunctionSubType property, can be Previous, a value stored immediately before the provided timestamp, Interpolated, a value calculated based on previous and next values, Next, a value stored immediately after the timestamp, or ExactTime, a value stored at the exact instant provided by the timestamp |
|
TagAttribute |
Returns a Tag's attribute, defined in Query's FunctionSubType property. The available options are FieldDescription, the meaning or description of a Tag, FieldSource, the path of a stored Tag, FieldType, a data type, FieldEU, the engineering unit, FieldLowEng, lower engineering limit, FieldHighEng, higher engineering limit, FieldDeadBand, a dead band for recording, FieldDeadBandUnit, a dead band's unit (in absolute or percentage values), FieldMinRecTime, a minimum time for recording (variations shorter than this interval are discarded), FieldMaxRecTime, a maximum time for recording (no variation in these intervals forces a recording), FieldSize, a Field's size, FieldVARTYPE, a Field's native data type, or FieldScanTimeMs, a scan time used to rebuild a Tag's chart |
Returns, for a single Tag, N values defined in the NumVals variable, stored based on an initial instant, defined in the StartTime variable |
|
Returns, for a single Tag, the values stored between the interval defined in the StartTime and EndTime variables |
|
Returns, for one or more Tags, the interpolated values, that is, estimated between the instants defined in the StartTime and EndTime variables, at fixed intervals defined by the TimeInterval variable |
|
Returns, for one or more Tags, the result of mathematical operations applied to data between the instants defined in the StartTime and EndTime variables, at fixed intervals defined by the TimeInterval variable. The available types of calculations are Total, Minimum, Maximum, StandardDeviation, Range, Average, or Mean |
NOTES |
•Only the SampledData and CalculatedData functions allow selecting more than one Field. All other functions require a selection of a single Field. •Functions that allow defining variables on the Variables tab can also define those variables at run time by using Query's SetVariableValue method. The only function that does not define variables is TagAttribute. •For more information on how the Variables and Visualize tabs work, please check topic Creating a Query. •For more information about the values returned by the FieldType and FieldVARTYPE options of the TagAttribute function, please check table Fields on the _Fields table. |