Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...
Reading Production Record Event Data with UTC timestamp
8min
use cases returning event 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 select query with function prorec prorec getprorecdatautc as from clause input variables variable name datatype description example @prorecid bigint a specific internal production record id if no specific production record id is to be queried or to get a list of production record id's, the value can also be default which will assume the value null 26817 default @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 @nodename varchar (50) the data model root node name if no specific nodename is to be queried or to get a list of nodename's, the value can also be default which will assume the value % testnode default @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 @itemname varchar (50) the name of the item in the data model if no specific item is to be queried or to get a list of item's, the value can also be default which will assume the value % itemname default @itemvalue varchar(256) a specific value for the item in the data model 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 @eng unit varchar (20) a specific engineering unit for the item in the data model (if defined) if no specific engineering unit for the item is to be queried or to return all engineering units if defined, the value can also be default which will assume the value % kg 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 @starttime 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 @endtime 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 @starttimeitem varchar (50) the function will try to calculate the overall duration of each recorded events and sub step included in the event to do so, it requires to know what is the item which does symbolize the start of the event if users have followed the litmus recommendations and used "start time", the value can be set as default otherwise, the user needs to provide the respective item if the item does not exist or was not recorded, the duration will not calculated and returned starttime default @endtimeitem varchar (50) the function will try to calculate the overall duration of each recorded events and sub step included in the event to do so, it requires to know what is the item which does symbolize the end of the event or sub step if users have followed the litmus recommendations and used "end time", the value can be set as default otherwise, the user needs to provide the respective item if the item does not exist or was not recorded, the duration will not calculated and returned endtime 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 how to use to query production record event data, execute a select statement from the function prorec prorec getprorecdatautc providing all the required inputs below is an example using t sql in sql server management studio select from \[le productionrecord] \[dbo] \[prorec prorec getprorecdatautc] ( default ,'asset\ l2 machine1 1 mb,start time 1678295211950' ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default) order by prorecid desc; 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 itemname, itemvalue, recordtime from \[le productionrecord] \[dbo] \[prorec prorec getprorecdatautc] ( default ,'asset\ l2 machine1 1 mb,start time 1678295211950' ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default); 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 itemname, itemvalue, recordtime from \[le productionrecord] \[dbo] \[prorec prorec getprorecdatautc] ( default ,'asset\ l2 machine1 1 mb,start time 1678295211950' ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default ,default) order by recordtime desc, itemname; the result will be a table, where all rows are first sorted by their recordtime in descending order and then by their itemname in ascending alphabetical order it is possible to filter data based on the value of a different specific item, which is not to be part of the result list in this example, we want the values of all part numbers when the value of the item asset is "machine1" select from \[dbo] \[prorec prorec getprorecdatautc] ( default ,default ,'production' ,default ,default ,default ,default ,default ,'partno' ,default ,default ,default ,'2023 07 03t11 29 04z' ,'2023 07 10t11 29 04z' ,default ,default ,n'production,asset,asset\ machine1' ,default ,default ,default ,default) the result will be a table, with the filtered data