Skip to main content

Typed Value Creation

AMPS includes functions for explicitly constructing constant values of various types. As stated in AMPS Data Types, AMPS operators and functions will automatically convert values to compatible types, but these functions can be used for explicit typing, value construction, and type casting.

FALSE_VALUE​

FALSE_VALUE​


FALSE_VALUE()

Returns a boolean false value. This function is most useful for constructing values in message types that have a distinct type for boolean values. In the AMPS expression language, false is equivalent to a literal 0.

Parameters

None.

Returns

A boolean false value.

TRUE_VALUE​

TRUE_VALUE​


TRUE_VALUE()

Returns a boolean true value. This function is most useful for constructing values in message types that have a distinct type for boolean values. In the AMPS expression language, true is typically represented with a literal 1.

Parameters

None.

Returns

A boolean true value.

NAN_VALUE​

NAN_VALUE​


NAN_VALUE()

Returns a NaN (not a number) value.

Parameters

None.

Returns

A NaN value.

CHAR_VALUE​

CHAR_VALUE​


CHAR_VALUE(integer)

Returns the character (byte) for the integer provided (0-255). This function is most useful for constructing values in message types that have a distinct type for char values.

In the AMPS expression language, a single character value is equivalent to a string constructed with an escape, and constructing a string literal is more efficient. That is, '\x01' is more efficient in a filter or field construction than CHAR_VALUE(1). However, to construct a character based on a field, use CHAR_VALUE.

Parameters

  • integer: An integer between 0 and 255.

Returns

The character corresponding to the integer. If integer is less than 0 or greater than 255, '?' is returned.