Inserting Tag Items if not using Litmus Edge Integration via JSON
Litmus Production Record Database allows for several ways to insert data into its tables.
The recommended way when using Litmus Edge, is to make use of the MSSQL Integrations to insert data directly into the table PROREC_Misc_Transactions. As it allows to make use of the integrated store and forward capability, preventing data loss on a connection interruption.
But for cases, where this is not an option, a stored procedure can be called by a program or code snippet to insert data data. Any application which provided the capability to use an ODBC connection can be used like:
- Python
- C#
- .Net
- Excel
- Go
- Java
Execute Stored Procedure PROREC_Misc_WriteIntoTransactionTables using a JSON object as Input.
Variable name | Datatype | Description | Example |
---|---|---|---|
@JSONInput | VARCHAR(8000) | A single JSON object which has to always include the keys:
Or an Array of JSON objects for multiple inserts | [{"deviceid":"P2_Electrical_Panel","registerid":"L3_Machine3_1_S7_Power","tagname":"Value","datatype":"##1694688509846##","value":"43.39283446097687","success":"1"},{"deviceid":"P2_Electrical_Panel","registerid":"L3_Machine3_1_S7_Speed","tagname":"Value","datatype":"##1694688519848##","value":"52.524841352846764","success":"1"}] |
To insert a value(s) for Production Tag Item(s) via JSON, call the stored procedure PROREC_Misc_WriteIntoTransactionTables using the T-SQL EXEC or EXECUTE keyword and provide the Input variable. 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 write them into the table PROREC_ProRec_Transactions. This will trigger their immediate processing. The result can be read back from the log table PROREC_Tag_Log.
Below is an example using T-SQL in SQL Server Management Studio:
With the result returned
For more detailed logging, enable the "Debug_Log" option for verbose logging as described in Reading out the Application configuration of Litmus Production Record Database and Modify Application Configuration Items