Show TOC

Conversion Functions for RulesLocate this document in the navigation structure

Provides the way for changing the context in which a function or data term within a rule is called.

The Conversion functions category of rule function terms provide the means for changing the context in which a function or data term within a rule is called. Within this category of conversion functions there is one function for the integral number, string, and property data types. The decimal number data type has two conversion functions, one of which is for use with significant digit math.

The name for each conversion function represents the data type to which it will set the context of the term that is its argument. The function term name, then, does not represent the data type to which a value will be converted, but the data type from which a value will be converted. Each conversion function supports all return types.

Conversion functions are most commonly used when it is necessary to obtain the return value of a function that may exhibit different behaviors in different contexts, or when the desired return data type does not match the supported return type of a given function. The caveat to this is that the conversion desired is type safe.

An example of this is the string function @FIND. This function searches a source string for a given sub-string. The function supports three return types, string, integral number and Boolean. The context in which this function is called will then dictate what type of value it will return. In a string context the function returns the sub-string when found within the source string. When called in an integral number context, the function returns the position, as a number, of the first character within the source string of the found sub-string. In a Boolean context the function will return true if the sub-string is found and false when it is not. For this function call a conversion function may be used to change the data type of the context in which it is called in order to obtain the desired value.