Write Rules Using Functions

A comprehensive set of rule functions are available for use in decision service and flow projects. For more information, see:

When you start writing the text of a function in a rule, a box will pop up showing all of the matching rule functions available.

The functions suggested for a rule in the rule editing pane in Intelligent Advisor Hub

Select the desired function to add the template for that function to your rule.

A rule template for a YearDifference function in Intelligent Advisor Hub

You then just need to add the required fields (in this example, fields for date1 and date 2) to complete the rule.

A rule containing a YearDifference function in Intelligent Advisor Hub

Notes about writing rules using functions:

  • There are two Maximum() functions and two Minimum() functions:

    These are entirely separate functions, and the compiler will work out which one you mean based on the first argument provided in the function (that is, whether it is a value or a record list).

  • There are no If versions of the Count, Maximum, Minimum and Sum record list functions. Instead you would use the Filter() function with these functions. For example:

    A decision service rule using the Filter and Count functions together

    Alternatively, you could save the filtered list into another field instead of using the Filter function nested in the Count function. For example:

    Decision service rules using the Filter and Count functions

    Note that Filter() considers null conditions to be false.

  • There are two OneOf() functions used to determine if a value is one of the specified values:

    • OneOf(value, option, …) - the version that takes a value that is a text, date, number, Boolean or record, and one or more options of the same type to test that value against. This version will always return either a true or false value, even if some or all of the provided parameters are null. Note that matches for string values when using the OneOf(value, option, …) function are case sensitive.

    • OneOf(value, record list) - the version that takes a value that is a record, and a record list of the same object type and tests whether the specified record is in the record list. This version can return null when the supplied record list is null, otherwise it will always return a true or false value. For more information, see Check If a Specified Record Is In a Record List.

    The compiler will work out which one you mean based on the arguments provided in the function.

  • The expected number format for the input value when using the Number conversion function is ####.## (that is, no thousand separator, and a period for the decimal value).

  • The If() and Default() functions can accept (and return) record references. For example:

    Decision service rules using the Default and If functions with record references

    The types of the arguments must match. For instance, if the first parameter is a reference to a record list, the second parameter must be a reference to the same record list.