Inserting Multiple Production Record Item if not using Litmus Edge Integration
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
Variable name | Datatype | Description | Example |
---|---|---|---|
@deviceid | VARCHAR(8000) | Pipe symbol "|" separated list of comma separated lists consisting of Node Name and optional Level Names | TestArea,Level1Name,Level2Name|TestArea,Level1Name,Level2Name,Level3Name|TestArea,Level1Name,Level2Name |
@registerid | VARCHAR(8000) | Pipe symbol "|" separated list of comma separated lists of Identifier Item Names | IdentifierItem1,IdentifierItem2|IdentifierItem1,IdentifierItem2,IdentifierItem3|IdentifierItem1,IdentifierItem2 |
@tagname | VARCHAR(8000) | Pipe symbol "|" separated list of Item Name | EventItem1|EventItem2|IdentifierItem1 |
@datatype | VARCHAR(8000) | Pipe symbol "|" separated list of comma separated lists of values for the Identifiers provided in @registerid | 1,100|Asset1,Shift1,Line2|1,100 |
@value | VARCHAR(8000) | Pipe symbol "|" separated list of values for the Item specified by @tagname | 12|Shutdown|1 |
@success | VARCHAR(8000) | Pipe symbol "|" separated list of definition if the Item is an Identifier? (1 = No, 0 = Yes) | 1|1|0 |
To insert multiple values for Production Record Item(s), call the stored procedure PROREC_Misc_WriteIntoTransactionTables 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 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_ProRec_Log.
Below is an example using T-SQL in SQL Server Management Studio:
With the result returned
Message | Meaning | Example which Triggers |
---|---|---|
One or more parameters are NULL, Please provide the correct values for each parameter. | One or more of the Input variables have no value provided. | EXEC [LE_ProductionRecord].[dbo].[PROREC_Misc_WriteIntoTransactionTables] |
One of the provided deviceid is invalid. The value is either the devicename for Tags or a comma separated list of the Node and optional Levelnames. | For at least one value for the Input Variable @deviceid a Unique Identifier such as "07045DE1-5AC1-4E12-B8F5-608EFC9C23C2" was provided | EXEC [LE_ProductionRecord].[dbo].[PROREC_Misc_WriteIntoTransactionTables]
@deviceid = N'07045DE1-5AC1-4E12-B8F5-608EFC9C23C2|TestArea,Level1Name,Level2Name,Level3Name|TestArea,Level1Name,Level2Name ',
@registerid = N'IdentifierItem1,IdentifierItem2|IdentifierItem1,IdentifierItem2,IdentifierItem3|IdentifierItem1,IdentifierItem2',
@tagname = N'EventItem1|EventItem2|IdentifierItem1',
@datatype = N'1,100|Asset1,Shift1,Line2|1,100',
@value = N'12|Shutdown|1',
@success = N'1|1|0' |
One of the provided registerid is invalid. The value is either the tagname for Tags or a comma separated list of the Identifiers. | For at least one value for the Input Variable @registerid a Unique Identifier such as "07045DE1-5AC1-4E12-B8F5-608EFC9C23C2" was provided | EXEC [LE_ProductionRecord].[dbo].[PROREC_Misc_WriteIntoTransactionTables]
@deviceid = N'TestArea,Level1Name,Level2Name|TestArea,Level1Name,Level2Name,Level3Name|TestArea,Level1Name,Level2Name ',
@registerid = N'07045DE1-5AC1-4E12-B8F5-608EFC9C23C2| IdentifierItem1,IdentifierItem2,IdentifierItem3|IdentifierItem1,IdentifierItem2',
@tagname = N'EventItem1|EventItem2|IdentifierItem1',
@datatype = N'1,100|Asset1,Shift1,Line2|1,100',
@value = N'12|Shutdown|1',
@success = N'1|1|0' |