Tani web based tools  2.01.01
Tani web socket JSON frames
Event Filter Syntax for OPC UA Interface

The event filter is a character string. It consists of a top-level predicate, which should evaluate to a boolean value.

A predicate can have parameters. These follow the predicate name in parenthesis and are separated by comma. Each parameter is another predicate. These are evaluated recursively. Whitespace is ignored except inside quotes.

Available Filter Predicates

Equals

Compares two values for equality.

IsNull

Tests if a value is NULL.

GreaterThan

Compares two values.

LessThan

Compares two values.

GreaterThanOrEqual

Compares two values.

LessThanOrEqual

Compares two values.

Not

Negates a Boolean value.

Between

Tests if a value falls between bounds.

InList

Tests if a value is in a list of allowed values.

And

Returns the logical conjunction of two values.

And

Returns the logical disjunction of two values.

BitwiseAnd

Returns the bitwise AND of two values.

BitwiseOr

Returns the bitwise OR of two values.

Cast

Converts the first value into the data type given in the second parameter.

OfType

Tests if the current event is of the given type.

Literal

Returns a constant value.

The data types and value formats are documented at: Data Types

Attribute

Returns an attribute value of the current event.

The browse path is given as one or more browse names. The names are separated by a full stop character. If required, a browse name may start with a namespace id and a colon. Optionally, the last part may be an attribute ID introduced by an at-sign.

If the browse name contains quotation marks, full stops or parentheses, enclose it by quotation marks, and double any quotation marks inside.

Examples

Select the ActiveState → Id attribute (a Boolean value)

Attribute(ActiveState.Id)

Select the event id (the NodeId attribute of the event itself), e.g. for acknowledging an alarm

Attribute(@NodeId)

Data Types

The following data types are allowed for Literal values.

Null

The NULL type signifies the absence of a useful value. No value must be added to the Literal predicate.

Boolean

A truth value. Allowed literals are:

Example:

Literal(Boolean, false)

SByte, Int16, Int32, Int64

Signed integer values. Literal values consist of an optional minus sign and one or more digits.

Example:

Literal(Int32, -10)

Byte, UInt16, UInt32, UInt64

Unsigned integer values. Literal values consist of one or more digits.

Example:

Literal(UInt16, 500)

Float, Double

Floating point values. Literal values consist ofan optional minus sign, one or more digits, optionally a full stop and more digits, and optionally a character E and an exponent.

Example:

Literal(Float, 3.14)

String

A character string. Should always be enclosed in quotes.

Example:

Literal(String, "My message.")

DateTime

A timestamp. Always given in ISO8601 format.

Example:

Literal(DateTime, "2023-10-31 18:00:00")

Guid

A globally unique identifier. Given in hexadecimal. Curly braces are optional.

Example:

Literal(Guid, "{01234567-89ab-cdef-0123-456789abcdef}")

ByteString

A byte string. TODO

NodeId, ExtendedNodeId

An OPC UA NodeId or ExtendedNodeId. Literal value is formatted as a string according to the OPC UA spedification,

Example:

Literal(NodeId, "ns=1;s=s7.mw0")

StatusCode

An OPC UA StatusCode value. Literal value is given as an UInt32 literal.

QualifiedName, LocalizedText

A qualified name or localized text value. Literals are given as character strings and may be prefixed by the namespace id or locale, separated by a colon.

Example:

Literal(LocalizedText, "de:Meine Nachricht")

Examples

Show only events with Severity 500 or greater:

GreaterThanOrEqual(Attribute(Severity), Literal(UInt16, 500))

TODO: more examples?