Functions

A number of functions come with the HMI Process Library. The following table shows additional general functions from the HMI Process Library:

Name

Category

Description

AnalogCompressionValueFormatter

Formatting

Return string for the passed value in compressed format (not bigger than given number of characters, excluding sign and dot).

Return value type: String.

Arguments:

  • value : The value being presented in compressed format. From -1015 to +1015 (excluding limits). The smallest absolute value can be 10-15.
  • type: String.
  • maxCharacters : Maximum number of characters the value should have (excluding sign and dot; can't be less than 4).
  • type: Number.
  • showPlus : If true, show plus sign for positive values.
  • type: Boolean.
  • fallbackValue : The result returned if the value is undefined or null. The default fallback value is 'NaN'.
  • type: String.

AnalogValueFormatter

Formatting

Return formatted string for the value passed in.

Return value type: String.

Arguments:

  • value : The value to format.
  • type: String.
  • maxDecimals : How many decimal places the value should have.
  • type: Number.
  • showPlus : If true, show plus sign for positive values.
  • type: Boolean.
  • fallbackValue : The result returned if the value is undefined or null. The default fallback value is 'NaN'.
  • type: String.

BinaryValueFormatter

Formatting

Return formatted string for the value passed in.

Return value type: String.

Arguments:

  • value : The value to format.
  • type: String.
  • trueValue : Replacement string for value true.
  • type: String.
  • falseValue : Replacement string for value false.
  • type: String.
  • fallbackValue : The result returned if the value is not TRUE or FALSE. The default fallback value is empty string.
  • type: String.

TernaryValueFormatter

Formatting

Return formatted string for the value passed in. [bVal1.toString() + bVal2.toString()].

Return value type: String.

Arguments:

  • value : The value to format [bVal1.toString() + bVal2.toString()], valid values
    • 'truefalse'
    • 'falsetrue'
    • 'falsefalse'
  • type: String.
  • truefalseValue : Replacement string for value ‘truefalse’.
  • type: String.
  • falsetrueValue : Replacement string for value ‘falsetrue’.
  • type: String.
  • falsefalseValue : Replacement string for value ‘falsefalse’.
  • type: String.
  • fallbackValue : The result returned if the value is not in the range of possible ones. The default fallback value is empty string.
  • type: String.

MapValueFormatter

Formatting

Returns a value which corresponds to the passed key.

Return value type: String.

Arguments:

  • key : The value to substitute
  • type: Any.
  • mapObj : Map for replacements key -> value. For example: {"key1": "value1", "key2": "value2"}
  • type: Object.
  • fallbackValue : The result returned if the key is not among keys of the mapObje. The default fallback value is an empty string.
  • type: String.

The following table shows the additional MTP specific functions from the HMI Process Library:

Name

Category

Description

MTPIsCommandEnabled

Checking

Return true if command is enabled.

Return value type: Boolean.

Arguments:

  • CommandEN : CommandEN variable of service.
  • type: Number.
  • Command : Command to be checked.
  • type: String.

MTPStateValueFormatter

Formatting

Return formatted state string for the value passed in.

Return value type: String.

Arguments:

  • value : The value to format.
  • type: String.

MTPUnitValueFormatter

Formatting

Return formatted unit string for the value passed in.

Return value type: String.

Arguments:

  • value : The unit value to format.
  • type: String.
  • customUnits: Dictionary for replacements num -> unit. num should be a positive integer number enclosed in quotation marks. The default value is {"1": "Custom unit 1", "2": "Custom unit 2"}
  • type: Object.
  • fallbackValue : The result returned if the value is undefined or null. The default fallback value is an empty string.
  • type: String.