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

Adding or Modifying a Tag Item

7min

Use Cases

To store Tag data inside Litmus Production Record Database, Tags and their Device association together with the Item's to be stored have to be setup.

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

Litmus does provide such as custom solution which can be downloaded from our Central Portal.

Method

Execute Stored Procedure PROREC_Tag_ProcessTagConfiguration

Note

Litmus Production Record Database can act similar to an Historian and allows to store data for individual defined tags and their meta data.

Input Variables

Variable name

Datatype

Description

Example

@TagName

VARCHAR(50)

The name of a tag.



Tag names can occur several times for different devices but have to be unique per device

Mandatory!

Can not be NULL or Empty

isRunning















@DeviceName

VARCHAR(50)

The name of a specific device.



It is recommended to use the same device name as used in Litmus Edge Mandatory!

Can not be NULL or Empty

L1_Machine2_1_MB

















@Item

VARCHAR(50)

The name of the Item of a tag.



Tags are not limited to their value but can be comprised of a large number of individual items to provide the right context.



This can include meta data, data which do not change frequently, such as a description, limits, area or plant.



As well as live data such as the process value, setpoint, alarm status or the results of calculations.



Mandatory!

Can not be NULL or Empty

Process_Value

@ItemDesc

VARCHAR(256)

An optional short description of the Item. Can be used to share some information about the Items purpose with other users,



Can be set to NULL.

Process value of the tag

@isDecimal

BIT

Is the value type of the Item a decimal/float/real value?

An Item can only have one data type.



Therefore only one of these 4 values can be 1, while the others are 0:

@isDecimal

@isInteger

@isString

@isBoolean

1

@isInteger

BIT

Is the value type of the Item an integer value?

An Item can only have one data type.



Therefore only one of these 4 values can be 1, while the others are 0:

@isDecimal

@isInteger

@isString

@isBoolean

0

@isString

BIT

Is the value type of the Item a alphanumeric string?

An Item can only have one data type.



Therefore only one of these 4 values can be 1, while the others are 0:

@isDecimal

@isInteger

@isString

@isBoolean

0

@isBoolean

BIT

Is the value type of the Item a boolean value?



This includes combinations of:

  • True/False
  • 1/0

An Item can only have one data type.



Therefore only one of these 4 values can be 1, while the others are 0:

@isDecimal

@isInteger

@isString

@isBoolean

0

@isMeta

BIT

Is the Item a meta data value or a live data value?



Possible Values:

1 = Yes

0 = No

0

@initValue

VARCHAR(256)

An optional initial value for the item. This is most commonly used for meta data items, as they have often no other source. For live data, this is typically not used, as the data are frequently written into the database from a



How to use

To insert a tag item, call the stored procedure PROREC_Tag_ProcessTagConfiguration 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_Tag_ProcessTagConfiguration] @TagName = N'isRunning', @DeviceName = N'L1_Machine2_1_MB', @Item = N'Process_Value', @ItemDesc = N'Process value of the tag', @isDecimal = 1, @isInteger = 0, @isString = 0, @isBoolean = 0, @isMeta = 0, @initValue = NULL;

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_Tag_ProcessTagConfiguration' Order by LogID Desc;

With the result returned

create new tag item
create new tag item