Operators producing a value

The following operators are available: sum, product, card, min, max, mean, convert.

Sum

XML tag:

Sum

Operands:

exactly one set of values

Synopsis:

<sum>
<Set of values>
</sum>

Operands:

Numerical data types (LONG, DOUBLE, TIMESPAN, FACTORYTIMESPAN, FREQUENCY, PERCENTAGE)

Result:

Value

Result type:

Data type of set of values used, for mixed data types within set always DOUBLE

Description:

Creates the sum of all elements in the set of values.

Calculation (PPM3/PPM4)

Result

Sum of values contained in the set of values. NULL if the transferred set is empty.

Error

If at least one element in the set of values is of an invalid data type.

Example:

-

Product

XML tag:

Product

Operands:

exactly one set of values

Synopsis:

<product>
<Set of values>
</product>

Operands:

Numerical data types (LONG, DOUBLE, TIMESPAN, FACTORYTIMESPAN, FREQUENCY, PERCENTAGE)

Result:

Value

Result type:

Data type of set of values used, for mixed data types within set always DOUBLE

Description:

Creates the product of all elements in the set of values.

Calculation (PPM3/PPM4)

Result

Multiplication of values contained in the set of values. NULL if the transferred set is empty.

Error

If at least one element in the set of values is of an invalid data type.

Example:

-

Cardinality

XML tag:

Card

Operands:

exactly one set of values

Synopsis:

<card>
<Set of values>
</card>

Operands:

All data types of the set of values specified

Result:

Value

Result type:

always LONG

Calculation (PPM3/PPM4)

Result

Calculates the total number of elements in the set of values. For an empty set, the return value is 0.

Error

None

Example:

-

Minimum

XML tag:

Min

Operands:

exactly one set of values

Synopsis:

<min>
<Set of values>
</min>

Operands:

Numerical data types and TIME (TIMESTAMP, DATE), DAY, TIMEOFDAY

Result:

Value

Result type:

Data type of set of values

Description:

Returns the smallest value in the set of values.

Calculation (PPM3/PPM4)

Result

NULL if the set of values is empty

Error

None

Example:

-

Maximum

XML tag:

Max

Operands:

exactly one set of values

Synopsis:

<max>
<Set of values>
</max>

Operands:

Numerical data types and TIME (TIMESTAMP, DATE), DAY, TIMEOFDAY

Result:

Value

Result type:

Data type of set of values

Description:

Returns the greatest value in the set.

Calculation (PPM3/PPM4)

Result

NULL if the set of values is empty

Error

None

Example:

-

Mean

XML tag:

Mean

Operands:

exactly one set of values

Synopsis:

<mean>
<Set of values>
</mean>

Operands:

Numerical data types (LONG, DOUBLE, TIMESPAN, FACTORYTIMESPAN, FREQUENCY, PERCENTAGE)

Result:

Value

Result type:

Operand data type

Calculation (PPM3)

Result

Mean of the numerical values contained in the set. NULL if operand is equal to an empty set.

Error

If the data type is invalid or at least one operand equals NULL.

Calculation (PPM4)

Result

Mean of the numerical values contained in the set. NULL if operand is an empty set or equals NULL.

Error

If at least one element in the set of values is of an invalid data type.

Example:

<mean>
<union>
<attribute name="AT_ANZAHL_POS1" nodetype="OT_FUNC"/>
<attribute name="AT_ANZAHL_POS2" nodetype="OT_FUNC"/>
</union>
</mean>

Data type conversion

XML tag:

convert

Operands:

exactly one value

Synopsis:

<convert datatype="...">
<value>
</convert>

Operands:

TEXT or numerical data type, returns the input value for the conversion.

Attribute:

The datatype attribute specifies the data type into which the input value is to be converted.

Result:

Value converted into the data type specified

Result type:

LONG, DOUBLE, FREQUENCY, BOOLEAN, TEXT, TIME, TIMESPAN, FACTORYTIMESPAN, DAY, PERCENTAGE

Description:

Conversion of a numerical data type (e.g., LONG, DOUBLE, TIMESPAN, FACTORYTIMESPAN, PERCENTAGE) into another numerical data type.

Conversion of the TEXT data type into one of these data types: LONG, DOUBLE, BOOLEAN, TIMESPAN, or FREQUENCY.

After the conversion, the result is written in base scaling to the result attribute.
The internal PPM format is used for conversion. You cannot specify a custom format.

Conversion of the LONG data type to TEXT, with leading zeros and separators being removed. The result of the conversion is the converted number without separators in one string. In the example below, the LONG value 000300080191 is converted into the TEXT value 300080191.

<convert datatype="TEXT">
<constant>
<dataitem>
000300080191
<datatype name="LONG"/>
</dataitem>
</constant>
</convert>

It is possible to convert any data type to TEXT, e.g.:

  • CONVERT(DOUBLE(-300080191)) -> TEXT("3.00080191E8")
  • CONVERT(TIME(07.01.1971 00:01)) -> TEXT("7.1.1971 0:01")
  • CONVERT(TIME(07.01.2000)) -> TEXT("07.1.1971")
  • CONVERT(BOOLEAN(1)) -> TEXT("FALSE") (everything that is not true is false)

The scaling used for the output corresponds to the one at the object, e.g.:

  • convert(<dataitem>1 YEAR<datatype name='TIMESPAN'/></dataitem>) -> TEXT("1.0 YEAR")
  • convert(<dataitem>1 YEAR<datatype name='TIMESPAN'/><scale name='MONTH'/></dataitem>) -> TEXT("12.166666666666666 MONTH") (== 365 days/30 days)

Calculation (PPM4 only)

Result

Returns the converted value of the operand. NULL if the operand returns NULL

Error

If conversion fails

Example:

<convert datatype="LONG">
<filteredattribute name="AT_ABC"
nodetype="PROCESS"/>
</convert>

An assumed value of 456 for the AT_ABC attribute of TEXT type is converted to the LONG data type.