Adding or Modifying a Data Model Item(s) via JSON
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
Execute Stored Procedure PROREC_ProRec_ProcessConfiguration using a JSON object as Input.
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
Variable name | Datatype | Description | Example |
---|---|---|---|
@JSONInput | VARCHAR(8000) | A single JSON object which has include the keys: Mandatory:
Optional:
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.
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:
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:
With the result returned