Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...

Inserting Single Production Record Item if not using Litmus Edge Integration

6min

Use Cases

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

Method

Execute Stored Procedure PROREC_Misc_WriteIntoTransactionTables

Input Variables

Variable name

Datatype

Description

Example

@deviceid

VARCHAR(8000)

Comma separated list consisting of Node Name and optional Level Names

TestArea,Level1Name,Level2Name

@registerid

VARCHAR(8000)

Comma separated list of Identifier Item Names

IdentifierItem1,IdentifierItem2

@tagname

VARCHAR(8000)

Item Name

EventItem

@datatype

VARCHAR(8000)

Comma separated list of values for the Identifiers provided in @registerid

1,100

@value

VARCHAR(8000)

The value for the Item specified by @tagname

12

@success

VARCHAR(8000)

Is the Item an Identifier? (1 = No, 0 = Yes)

1

How to use

To insert a single Production Record Item value, 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:

EXEC [LE_ProductionRecord].[dbo].[PROREC_Misc_WriteIntoTransactionTables] @deviceid = N'TestArea,Level1Name,Level2Name', @registerid = N'IdentifierItem1,IdentifierItem2', @tagname = N'EventItem', @datatype = N'1,100', @value = N'12', @success = N'1';

Result

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:

SELECT TOP (100) [LogID] ,[LogType] ,[LogProcedure] ,[LogEntry] ,[LogTime] FROM [LE_ProductionRecord].[dbo].[PROREC_ProRec_Log] Order by LogID Desc;

With the result returned

ProRec Log Single Item Insert
ProRec Log Single Item Insert


Messages Returned by the Stored Procedure

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]

Invalid value for deviceid. The value is either the device name for Tags or a comma separated list of the Node and optional Level names.

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', @registerid = N'IdentifierItem1,IdentifierItem2', @tagname = N'EventItem', @datatype = N'1,100', @value = N'12', @success = N'1'

Invalid value for registerid. The value is either the tag name for Tags or a comma separated list of the Identifiers.

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', @registerid = N'07045DE1-5AC1-4E12-B8F5-608EFC9C23C2', @tagname = N'EventItem', @datatype = N'1,100', @value = N'12', @success = N'1'