Formula Editor

The FintechOS Formula Editor is a complex tool found in the Studio. It is the place where a user writes an actual mathematical expressions and calculations. The FintechOS Formula Editor is found at the bottom of the “Add/Edit formula step” form.

For example, based on what a client inserts as data in his/hers KYC, the editor takes that information and uses the calculation formula inserted into the Editor 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 using complex arguments and functions. It is possible to test the formula inserted here by running a test. For more information about running a test, see Define Formula Expressions.

Syntax

In the Editor, a user inserts the formula that is built based on a given mathematical syntax whose structure is made of the formula body and the call for calculation which is the actual result.

IMPORTANT!  
When writing the formula, make sure that each formula matches to the step you are working on because the result may be used as input in the following steps.

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

Copy
result = <formula expression>;

For formulas that return collections, use the following syntax (make sure that the formula expression includes an iteration argument):

Copy
result[i] = < ... iterationArgument[i] ... >;

For recursive formulas, define a simple type whole number formula and include a whole number argument in the Number of Iterations field (see Define Formula Expressions for details). For example, to generate a collection with the first x numbers in 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];

When the formula body is complex, needs periodic update or must be simplified for transparency and traceability, we suggest you split it in separate steps, each with its own expression.

NOTE  
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 order of execution between operations such as addition “+”, substraction “-“, multiplication “*” and division “/” is respected and you can further control this by using parantheses () or by splitting the formula in steps.

In a formula receiving an argument data of a complex type with properties A,B,C of type string and D,E of type numeric, we can write:

Copy
var result = FROM(data).GROUPBY(["A","B"]).SUM("D");

The result will be a collection of items with properties A,B and C, where C will be the SUM for the group determined by the content of properties A and B

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.

Formula 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.
HINT  
Already pre-defined Steps also appear in Intellisense since they can be called in any subsequent step.

Click the ''Save and Close'' button.

Formula Arguments

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

Copy
result = days / 365;

We can also use previous steps' outputs as arguments for subsequent step inputs. For example, after the above step, we 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

 

Built-in Functions

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

Function Description Example

Result

SUM(Vector)

SUM function can be used to add all numbers in a range of cells. The arguments can be numbers, cells references or formula-driven numeric values.

For instance, if you would like to calculate the sum of all items part of an array then you need to use an iteration formula.

SUM([1, 2, 3])

6

ABS(Number) It returns the absolute value of the number. ABS(-3)

3

POWER(Number, Exponent) Calculates how many times to use the number in a multiplication. POWER(10,3) 1000
ODD(Number) Specifies if the number is odd. ODD(12)

false

EVEN(Number) Specifies if the number is even. EVEN(26)

true

TRUNC(Number) Truncates the number to a specified number of decimal places. TRUNC(17.51)

17

ROUND(Number, Precision) Rounds the number to the specified number of digits. ROUND(17.51)

18

ROUNDUP(Number) Rounds the number upward to the specified number of digits. ROUNDUP(-0.6)

0

ROUNDDOWN(Number) Rounds the number downward to the specified number of digits. ROUNDDOWN(1.9)

1

FLOOR(Number) Receives one parameter and rounds the number down. FLOOR(6.7)

6

IIF(Condition, TrueExpression, FalseExpression) IF function is a "conditional function" because it returns a value based on the condition that you specify.  

 

COUNT(Vector) Returns the number of numerical values (numbers and dates) in the list of arguments.  

 

COUNTIF(Vector, FilterExpression) Counts the number of cells within the range that meet the specified criteria.  

 

MIN(Vector) Returns the minimal value from the list of arguments in a row. MIN(1,2,3,5,6)

1

MAX(Vector) Returns the maximum value from the list of arguments in a row. MAX(111,22,33,44,55)

55

AVERAGE(Number1, Number2, Number3, …) Returns the average of the arguments. AVERAGE(1234,67543,5752)

24843

AVERAGE(Vector) Returns the average of the arguments in a row. AVERAGE ([4643,652348,83284])

246758

SUMIF(Vector, FilterExpression)

Adds up the cells in a specified range that meet a certain condition. SUMIF can evaluate only a single criteria.

“it” is a mandatory term, standing for “item” of an array, for all Filter Expressions in all formulas which evaluate an expression.

 

 

SELECT(Vector, TransformExpression)

 

SELECT (IncomeList, it * Database (''IncomeAdjuster''))

 

RANGE(Vector, RangeOperators) Navigate inside an array RANGE([1,2,3,4,5,6],SKIP(2)])

VECTOR(3,4,5,6)

SKIP(Number)

Combined with RANGE function, you can skip an item of an array, in case for example you would like to add all items except the 3rd one in the array.

 

 

TAKE(Number) Combined with RANGE function, you can take as many array items as indicated by the input parameter.  

 

Examples

For Simple types

           

For Collection types

     

For Simple Collections types

    

 

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.