Formula Language

How to write formulas in the DigiFi platform.

Overview Of DigiFi Formulas

DigiFi's formula language is powerful tool that lets you write complex calculations using simple syntax and Excel-like functions. It is used through the DigiFi platform for a number of purposes, including:

In general, formulas in DigiFi are simple functions that look comparable to spreadsheet functions, for example in Microsoft Excel or Google Sheets. They can include mathematical operators and built-in functions, and can reference variables (i.e. data fields) within the calculations.


Basic Lexical Constructions

DigiFi's formula language consists of few basic lexical constructions, including:

Identifiers

You can access variables within formulas by using their system name.

borrower_first_name + borrower_last_name

Unary Operators

Operator

Symbol

Example

Negate

!

!system_variable


Binary Operators

Operator

Symbol

Example

Add, Concat

system_variable + system_variable_2

Subtract

system_variable - system_variable_2

Multiply

system_variable * system_variable_2

Divide

/

system_variable / system_variable_2

Divide And Floor

//

system_variable // sytem_variable_2

Modulus

%

system_variable % system_variable_2

Power Of

^

system_variable ^ 2
system_variable ^ system_variable_2

Logical And

&&

system_variable && system_variable_2

Logical Or

||

system_variable || system_variable_2


Comparison Operators

Operator

Symbol

Example

Equal

==

system_variable == 10
system_variable == system_variable_2
system_variable == null
system_variable == true

Not equal

!=

system_variable != 10
system_variable != system_variable_2
system_variable != null
system_variable != true

Greater than

system_variable > 10
system_variable > system_variable_2

Greater than or equal

=

system_variable >= 10
system_variable >= system_variable_2

Less than

<

system_variable < 10
system_variable < system_variable_2

Less than or equal

<=

system_variable <= 10
system_variable <= system_variable_2


Ternary Operators

Conditional expressions check to see if the first segment evaluates to a truthy value. If so, the consequent segment is evaluated. Otherwise, the alternate is. If the consequent section is missing, the test result itself will be used instead.

Expression

Result

"" ? "Full" : "Empty"

"Empty"

system_name == 10 ? "Yes" : "No" where system_name equals to 20

"No"


Native Types

Type

Example

Boolean

true, false

String

"some_string"

Numeric

10, 20, 100000, -5000

Arrays

['hello', 'world!']


Groups

Expression

Result

(10 + 2) / 2

6

system_variable && (system_variable_2 || system_variable_3) where system_variable equals to 10, system_variable_2 equals to null and system_variable_3 equals to 40

40


Excel-Like Functions

You can use many Excel-like functions within DigiFi formulas. For example:

Function Description

Function Identifier

Example

Result

Logical AND function

AND

AND(true, false, true)

true

IF function

IF

IF(system_name == 10, "Approved", "Rejected"), where system_name equals to 10

"Approved"

Module Function

ABS

ABS(-10)

10

Logarithm Function

LOG

LOG(8, 2)

3

Lower Case Function

LOWER

LOWER('APPROVED`)

"approved"

Maximum Function

MAX

MAX(10, 20, 30)

30

You can find full list of the functions here: