Reading Production Record Event Data for SPC with UTC timestame
Returning event 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_ProRec_SPCChartsForProRecItems
Variable name | Datatype | Description | Example |
---|---|---|---|
@ItemName | VARCHAR(50) | The name of the Item in the Data Model. Mandatory! Can not be NULL or Empty | ItemName |
@NodeName | VARCHAR(50) | The Data Model root Node name. Mandatory! Can not be NULL or Empty | TestNode |
@Level1 | VARCHAR(50) | The name of a the first Sub Level in the Data Model (if defined). If no specific Level1 is to be queried or to get a list of Level1's, the value can also be DEFAULT which will assume the value %. | TestLevel1 DEFAULT |
@Level2 | VARCHAR(50) | The name of the second Sub Level in the Data Model (if defined). If no specific Level2 is to be queried or to get a list of Level2's, the value can also be DEFAULT which will assume the value %. | TestLevel2 DEFAULT |
@Level3 | VARCHAR(50) | The name of the third Sub Level in the Data Model (if defined). If no specific Level3 is to be queried or to get a list of Level3's, the value can also be DEFAULT which will assume the value %. | TestLevel3 DEFAULT |
@Level4 | VARCHAR(50) | The name of the fourth Sub Level in the Data Model (if defined). If no specific Level4 is to be queried or to get a list of Level4's, the value can also be DEFAULT which will assume the value %. | TestLevel4 DEFAULT |
@Level5 | VARCHAR(50) | The name of the fifth Sub Level in the Data Model (if defined). If no specific Level5 is to be queried or to get a list of Level5's, the value can also be DEFAULT which will assume the value %. | TestLevel5 DEFAULT |
@Occurrence | INTEGER | A specific occurrence of the Item in the Data Model. If no specific occurrence for the Item is to be queried or to return all occurrence's, the value can also be DEFAULT which will assume the value null. This can be useful if for example an operation can run multiple times throughout a process. | 2 DEFAULT |
@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 |
@Identifiers | VARCHAR (8000) | A key-value pair or comma separated list of key-value pairs for know Identifiers which describe a Production Record. If no specific Identifiers are to be queried or to get a list of Identifiers 's, the value can also be DEFAULT which will assume the value %. | Asset:L2_Machine1_1_MB,START_TIME:1678295211950 DEFAULT |
@FilterItemName1 | VARCHAR (256) | In cases where results are to be filtered additionally to the Identifiers, for example based on the value of a specific item, the function allows to provide up to 5 additional filters for this purpose. This can be understood similar to the use of where clauses, but reduces the complexity for users. To use the filter, the user has to provide the hierarchy and item name as a comma-separated string followed by the item value separated by a double point. If no specific Filter is to be used the value can also be DEFAULT which will assume the value % which applies no filter. | 'Production,Asset,Step1,Site:LA' DEFAULT |
@FilterItemName2 | VARCHAR (256) | In cases where results are to be filtered additionally to the Identifiers, for example based on the value of a specific item, the function allows to provide up to 5 additional filters for this purpose. This can be understood similar to the use of where clauses, but reduces the complexity for users. To use the filter, the user has to provide the hierarchy and item name as a comma-separated string followed by the item value separated by a double point. If no specific Filter is to be used the value can also be DEFAULT which will assume the value % which applies no filter. | 'Production,Asset,Step1,Plant:Plant1' DEFAULT |
@FilterItemName3 | VARCHAR (256) | In cases where results are to be filtered additionally to the Identifiers, for example based on the value of a specific item, the function allows to provide up to 5 additional filters for this purpose. This can be understood similar to the use of where clauses, but reduces the complexity for users. To use the filter, the user has to provide the hierarchy and item name as a comma-separated string followed by the item value separated by a double point. If no specific Filter is to be used the value can also be DEFAULT which will assume the value % which applies no filter. | 'Production,Asset,Step1,Shift:2' DEFAULT |
@FilterItemName4 | VARCHAR (256) | In cases where results are to be filtered additionally to the Identifiers, for example based on the value of a specific item, the function allows to provide up to 5 additional filters for this purpose. This can be understood similar to the use of where clauses, but reduces the complexity for users. To use the filter, the user has to provide the hierarchy and item name as a comma-separated string followed by the item value separated by a double point. If no specific Filter is to be used the value can also be DEFAULT which will assume the value % which applies no filter. | 'Production,Asset,Step1,Line:1' DEFAULT |
@FilterItemName5 | VARCHAR (256) | In cases where results are to be filtered additionally to the Identifiers, for example based on the value of a specific item, the function allows to provide up to 5 additional filters for this purpose. This can be understood similar to the use of where clauses, but reduces the complexity for users. To use the filter, the user has to provide the hierarchy and item name as a comma-separated string followed by the item value separated by a double point. If no specific Filter is to be used the value can also be DEFAULT which will assume the value % which applies no filter. | 'Production,Asset,Step1,Asset:Machine1' DEFAULT |
To query production record event data for SPC, execute the stored procedure PROREC_ProRec_SPCChartsForProRecItems 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.