Formula Editor

The formula editor is where you write the formula's actual mathematical expressions and computations. You can find the formula editor at the bottom of the “Add/Edit formula step” form.

For example, based on the data a client inserts as their KYC, the formula editor applies a calculation to return data such as the net income of a loan applicant or the age limit for a contract or the insurance premium for a policy. You can also test your formula before activating it. For more information about running tests, see Define Formula Expressions.

Syntax

In the editor, insert your formula expression based on a mathematical syntax comprised of the formula body and a call for calculation (the returned result). IntelliSense is available for quick selection of definitions and to provide additional information (such as properties and attributes) about the selected item.

IMPORTANT!  
When writing a formula, make sure the calculations match the step you are on, because the result may be used as input in the subsequent steps.

Use the following syntax in the formula editor to define a formula output:

Copy
result = <formula expression>;
 

You can include multi-line C# code in the formula expression, as long as you assign a result value:

Copy
var a = 1;
var b = 2;
result = a + b;
 

The usual operator precedence for operations such as addition “+”, substraction “-“, multiplication “*” and division “/” is enforced and you can further control this by using parantheses () or by splitting your computation in multiple steps.

Formulas can be of the following types:

  • constant: f = sum(1,n)
  • linear: f(x) = 2*x+1 , where x = 1,100
  • 2-dimensional: f(x,y) = x*y+30;
  • n-dimensional etc.
  • recursive: f(x) = f(x-1)+20.

Formula Arguments

Primary formula arguments are defined in the formula input (see Formula Inputs). For example, if you defined an argument called days in the formula input, you can create a formula step called years to convert the number of days into years with the following expression:

Copy
result = days / 365;

You can also use previous steps' outputs as arguments for subsequent step inputs. For example, after the above step, you can create a step that calculates an interest by multiplying the principal and rate input parameters with the years result from the previous step:

Copy
result = principal * rate * years

Dynamic Collections Definitions

For collection outputs that use an Iteration calculation type, you must provide a generic formula that defines the value of a collection item in relation to the iteration counter specified in the Number of Iterations field (for details, see Add steps to a formula).

Copy
result[i] = <formula expression>;
 

For example, if based on a collection of item prices called Values (either an input argument or an output from a prior step), you wish to generate a collection of objects that pair together item numbers with their corresponding prices, you can use the following step formula:

Copy
result[i] = new {Name = "Item" + i, Price = Values[i]};
NOTE  
To make sure that the number of items matches the number of prices, set the number of iterations to Values.

Recursive formula definitions are also supported. For example, to generate a collection with the first x numbers in the Fibonacci sequence, use a whole number input argument called x for the number of iterations (make sure x is greater than or equal to 2) and use the following formula expression:

Copy
result[0] = 1;
result[1] = 1;
result[i] = result[i-1] + result[i-2];

IntelliSense Support

Pressing Ctrl+Space will launch the IntelliSense that can help you learn more about the formula you are editing, keep track of parameters you’re typing, add calls to functions and various information with only a few keystrokes.

HINT  
Already pre-defined Steps also appear in IntelliSense since they can be called in any subsequent step.

Built-in Functions

You can include the following built-in functions in your formula expressions:

For Simple types

 

For Collection Types

For Simple Collections Types

 

Formula Built-in Excel Functions

Formula Built-in DateTime Functions

Data Set Calls

To extract value mappings from data sets (see Data Sets for details), use the following syntax:

Copy
DataSet("<data set name>", ("<discriminant 1 name>", <discriminant 1 value>), ("<discriminant 2 name>", <discriminant 2 value>) ... )

If all the discriminants are given as a parameter, the result will be a value. However, if one of the discriminants is not sent as a parameter, the result will be an array.

IMPORTANT!  
You can only call data sets that are active. For details, see Data Set Versioning.