Reading Tag Data for SPC with UTC timestame
Returning tag data recorded by Litmus Production Record Database for SPC analytics 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.
Execute Stored Procedure PROREC_Tag_SPCChartsForTags
Variable name | Datatype | Description | Example |
---|---|---|---|
@TagItem | VARCHAR(50) | The item of the tag which the value represents. Mandatory! Can not be NULL or Empty | Value |
@TagName | VARCHAR(50) | The Tag name. Mandatory! Can not be NULL or Empty | Pressure |
@DeviceName | VARCHAR(50) | The device name for the tag. Mandatory! Can not be NULL or Empty | Asset1 |
@TimeSTART | DATETIME | The start of the time period for which to query data. 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-09T13:04:39.647 DEFAULT |
@TimeEND | DATETIME | The end of the time period for which to query data. 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-10T13:04:39.647 DEFAULT |
@subgroups | INT | The subgroup size. Subgroups consist of individual measurements or readings and the number of measurements or readings is referred to as the subgroup size Values can range between 2 and 25 A common subgroup size is 5. Mandatory! Can not be NULL or Empty | 5 |
@spcchart | VARCHAR(10) | Is the type of the SPC chart. The available options are:
Mandatory! Can not be NULL or Empty | rbar |
To query production record event data for SPC, execute the stored procedure PROREC_Tag_SPCChartsForTags providing all the required inputs. Below is an example using T-SQL in SQL Server Management Studio:
The function returns a table as result. The Time is in UNIX time format.