Developer

Rule Functions Overview

Rule function are the heart of most application rule definitions. Occasionally, a rule may be defined to contain a single rule term that returns the value of a global or other such data definition type; however, most rules are more complex and consist of multiple function calls.

Most rule function terms, or simply rule functions, take one or more arguments, each of which contains a data value for the function. When the function is evaluated, these data values are processed accordingly, and return a single return value that is passed to the function’s caller. A function always provides the caller with a value of the data type for which the caller asks. Not all functions support all data types for return values. If a data type is not supported by the function, that function returns the null-equivalent of that data type.

There are over a hundred different available rule definition functions, which are organized into Function Categories that denote the general behavior type. The rule editor presents the functions to the developer organized in these categories.
  • Conversion Functions ‒ set the context of a given term to a specified data type. A conversion function supports all return types within the rule definition. The names of conversion functions dictate what data type they set for the context of a function call.
  • Logical Functions ‒ provide the comparison and decision making functionality to a rule. This includes if-then-else, and comparison operations and behaviors.
  • Mathematical Functions ‒ provide mathematical operations, including addition, subtraction, multiplication, division, and modulus operations, as well other mathematical functions, such as rounding, and working with significant digits.
  • Property Functions ‒ operate on properties, usually of a certain data type. Most property functions are provided to work with a given type of property, such as an object collection or external data property.
  • String Functions ‒ provide behaviors for manipulating string values, including concatenation and parsing operations, string search and replacement, and other string-related operations.
  • System Functions ‒ provide access to information about the Agentry Client’s host system, or general client information, such as the system’s time and date, or the user ID of the current user. This category also includes functions for accessing hardware components of the client device such as barcode scanners and GPS units.
  • Table Functions ‒ provide access to the records of complex table and data tables stored on the Agentry Client.

The function categories do not directly impact where a function can be used, or which rules can use a given function; they are simply an organizational aid that is built into the rule editor to aid developer in locating the rule function that is needed.