Obsolete features

Deprecations

Starting from version v1.1.0 the following instructions are deprecated. In a future version they will be removed.

set: Set a variable

Syntax

set <variableName> <value>

Sets the internal variable variableName to the value value.

Examples

set COUNTER 1
SET COUNTER ${I}
Set COUNTER modbus/cnt
set status true
set message "hi"
set message2 ${message}
set message2 ${p}
set _v 23

add: Add a value to a variable

Syntax

add <variableName> <numeric value>

Add a numeric value to the internal variable variableName.

Examples

add counter 1
add counter ${B}
add a step7/a[3]
add a ${_v}

sub: Subtract a value from a variable

Syntax

sub <variableName> <numeric value>

Subtract a numeric value from the internal variable variableName.

Examples

sub counter 1
sub counter ${B}
sub a step7/a[3]

mul: Multiply a variable times a value

Syntax

mul <variableName> <numeric value>

Multiply the internal variable variableName times the numeric value.

Examples

mul counter 1
mul counter ${B}
mul a step7/a[3]

div: Divide a variable by a value

Syntax

div <variableName> <numeric value>

Divide the internal variable variableName by the numeric value.

Examples

div counter 1
div counter ${B}
div a step7/a[3]

round: Round a variable value

Syntax

round <variableName>

Round the internal variable variableName to the closest integer.

Examples

round counter

concat: Concatenate a string value to a variable

Syntax

concat <variableName> <value>

<value> gets concatenated to the internal variable. Both <value> and the variable are converted into string prior the concat operation.

Examples

concat message 'hello'
concat message ${msg}
concat message opcua/plc1.status

Conversion statements

toNumber: Convert a variable value to a number

Syntax

toNumber <variableName>

the content of the variable is converted into a number and assigned to the variable itself. If the conversion fails, zero is returned, and a warning is logged.

Examples

toNumber counter

toString: Convert a variable value to a string

Syntax

toString <variableName>

the content of the variable is converted into a string and assigned to the variable itself.

Examples

toString counter

toBoolean: Convert a variable value to a to a boolean

Syntax

toBoolean <variableName>

the content of the variable is converted into a boolean and assigned to the variable itself. The following rules are used:

  • if a number, 0 becomes false, otherwise true
  • if a string, the empty string, strings containing only spaces, and the string "0" become false, otherwise true

Examples

toBoolean counter

Metadata Statements

addMetadata: Add a metadata field to the outgoing payload

Syntax

addMetadata <metadata key> <value>

<metadata key> must be a quoted string. <value> is the value set to the <metadata key> property.

Examples

addMetadata "batch" ethernetip/batchnum

The resulting payload will be, as an example:

{
    "value": 115,
    "ts": 1612043702457,
    "metadata": {
        "batch": "2567B"
    }
}