Reading the last number of Tag Meta Data with Local timestamp
As tag Meta data can be very infrequent and users may not always know the last time stamp, Litmus Production Record Database allows to return the last recorded values. Returning these last tag Meta data recorded by Litmus Production Record Database through the use of these SELECT statements can be used for example by any visualization platform which allows to integrate with MSSQL like;
- Grafana
- PowerBI
- Tableau
Further can these queries be used by any other application which allows for an ODBC connection such as:
- Excel
- C#
- .Net
- Python
- R
They can also be part of a larger stored procedure developed by users with T-SQL.
Run SELECT query with Function PROREC_Tag_GetLastTagMetaDataLocalTime as FROM clause.
Tag Meta data are a subset of data which can be stored for a tag and are updated infrequently. This can be data such as Alarm Limits, descriptions or anything usable to further describe a tag.
Variable name | Datatype | Description | Example |
---|---|---|---|
@Tag | VARCHAR(50) | The Tag name. If no specific Tag name is to be queried or to get a list of Tag name's, the value can also be DEFAULT which will assume the value %. | Pressure DEFAULT |
@Device | VARCHAR(50) | The device name for the tag. If no specific device is to be queried or to get a list of devices, the value can also be DEFAULT which will assume the value %. | Asset1 DEFAULT |
@Item | VARCHAR(50) | The Meta Data item of the tag which the value represents. If no specific Meta Data item is to be queried or to get a list of item's, the value can also be DEFAULT which will assume the value %. | High_High_Limit DEFAULT |
@NumberOfResults | INTEGER | How many results are to be returned? If no specific number of results is set, the value can also be DEFAULT which will assume the value null which is equivalent to 1. | 2 DEFAULT |
@Timezone | INTEGER | The Number of hours your local time zone is ahead or behind the GMT time zone. If the user does not know this value, it can be left as DEFAULT which will assume the value 0 or GMT. The value can be positive (example: 8 for UTC +8) or negative (example: -6 for UTC -6) | 2 DEFAULT |
To query tag data, execute a SELECT statement from the function PROREC_Tag_GetTagMetaDataUTC providing all the required inputs. Below is an example using T-SQL in SQL Server Management Studio:
The function returns a table as result.
It is possible to reduce the number of columns returned by the SELECT statement. Below is an example using T-SQL in SQL Server Management Studio:
This will reduce the number of columns returned to only the three selected.
It is possible to sort data based on users requirements returned by the SELECT statement. Below is an example using T-SQL in SQL Server Management Studio:
The result will be a table, where all rows are sorted by their TagValue in ascending order.