Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...
Reading Tag Meta Data with Local timestamp
8min
use cases returning 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 method run s elect query with function prorec tag gettagmetadatalocaltime as from clause note 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 input variables 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 @tagvalue varchar(256) a specific value for the item of the tag if no specific value for the item is to be queried or to return all values, the value can also be default which will assume the value % 20 default @quality varchar(4) a specific quality of the tag value (good or bad) if no specific quality for the value is to be queried or to return all qualities, the value can also be default which will assume the value % good default @starttime datetime the start of the time period for which to query data the time will be treated as in local time and will be adjusted to utc using the @timezone value if no specific start time is required, the value can also be default which will assume the value null this will trigger the function to calculate a start time of 1h from the current time stamp this means the default time period for which data are returned is always the last hour 2023 03 09 12 57 59 200 default @endtime datetime the end of the time period for which to query data the time will be treated as in local time and will be adjusted to utc using the @timezone value if no specific end time is required, the value can also be default which will assume the value null this will trigger the function to use the current time stamp this means the default time period for which data are returned is always the last hour 2023 03 10 12 57 59 200 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 how to use 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 select from \[le productionrecord] \[dbo] \[ prorec tag gettagmetadatalocaltime ] ( default ,default ,default ,default ,default ,'2022 12 01 14 13 21 000' ,default ,1); result the function returns a table as result additional options 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 select recordtime, item, tagvalue from \[le productionrecord] \[dbo] \[prorec tag gettagmetadatalocaltime] ( 'toolctr axis x' ,'toolctr v1 3bsm makino1' ,default ,default ,default ,'2022 12 01 14 13 21 000' ,default ,1); 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 select recordtime, item, tagvalue from \[le productionrecord] \[dbo] \[prorec tag gettagmetadatalocaltime] ( 'toolctr axis x' ,'toolctr v1 3bsm makino1' ,default ,default ,default ,'2022 12 01 14 13 21 000' ,default ,1) order by tagvalue asc; the result will be a table, where all rows are sorted by their tagvalue in ascending order