Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...
Adding or Modifying a Data Model Item(s) via JSON
7min
note this requires litmus production record database v 1 4 0 0 or higher use cases litmus production record database makes use of data models based on isa 88 to store and publish event data to be able to store event data, such a data model has to be configured first user can do this either by using applications such as microsoft sql server management studio mssql cli this can also be used for building custom solutions based on applications which allow for an odbc connection such as excel c# net python method execute stored procedure prorec prorec processconfiguration using a json object as input note do learn more about the data model concept and how to define it, please read the document core concept behind recording production record data via data model docid\ ffsctesqgb9gj7wy5kymo input variables variable name datatype description example @jsoninput varchar(8000) a single json object which has include the keys mandatory node > the name of the root node and the name of the data model item > the name of the item which represents the value istime > is the value type of the item a time stamp? isnumeric > is the value type of the item a numeric value? isstring > is the value type of the item a alphanumeric string? isboolean > is the value type of the item a boolean value? isid > is this item an identifier? optional level1 > the name of the first sub level in the isa 88 based data model hierarchy level2 > the name of the second sub level in the isa 88 based data model hierarchy level3 > the name of the third sub level in the isa 88 based data model hierarchy level4 > the name of the fourth sub level in the isa 88 based data model hierarchy level5 > the name of the fifth sub level in the isa 88 based data model hierarchy nodedesc > an optional short description of the model level1desc > an optional short description of level1 level2desc > an optional short description of level2 level3desc > an optional short description of level3 level4desc > an optional short description of level4 level5desc > an optional short description of level5 itemdesc > an optional short description of the item itemeng > an optional engineering unit for items users can also provide an array of json objects for multiple inserts \[{"node" "energymonitoringdevice dtdl","item" "asset","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ true},{"node" "energymonitoringdevice dtdl","item" "dt instance","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ true},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[0]","item" "tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[1]","item" "instance","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[1]","item" "model","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "line tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "name tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "plant","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false}] for a more detailed explanation of the content to be provided by each key, please read the document adding or modifying a data model item docid\ qyze9xsk0xr evob1iukx how to use to insert a data model item(s), call the stored procedure prorec prorec processconfiguration using the t sql exec or execute keyword and provide the input variables below is an example using t sql in sql server management studio execute \[le productionrecord] \[dbo] \[prorec prorec processconfiguration] @jsoninput= n' \[{"node" "energymonitoringdevice dtdl","item" "asset","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ true},{"node" "energymonitoringdevice dtdl","item" "dt instance","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ true},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[0]","item" "tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[1]","item" "instance","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "meta\[1]","item" "model","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "line tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "name tag","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false},{"node" "energymonitoringdevice dtdl","level1" "metadata","level2" "rawmetadata","item" "plant","istime"\ false,"isnumeric"\ false,"isstring"\ true,"isboolean"\ false,"isid"\ false}] ' ; result the stored procedure will verify that the provided values are correctly formatted and then create any new node, levels and items or modify existing items the result can be read back from the log table prorec misc log below is an example using t sql in sql server management studio select top (100) \[logid] ,\[logtype] ,\[logprocedure] ,\[logentry] ,\[logtime] from \[le productionrecord] \[dbo] \[prorec misc log] where \[logprocedure] = 'prorec prorec processconfiguration' order by logid desc; with the result returned