Skip to main content
Calculated Fields

Learn how to enrich your data model with calculated fields

Forwrd Support avatar
Written by Forwrd Support
Updated over 4 months ago

Introduction

The decision base defines the data set of your predictive model. Using Calculated Fields you can enrich your data set and add additional parameters for the predictive model, for example calculating the number of days that have past since the user's last activity (based on last activity date).

Supported Functions

The following functions are supported:

Function Name

Description

Example

abs

Calculates the absolute value for a field and a power

abs(@Field) - > "2" given Field=-2

and

Applies the logical and operator Allows multiple logical statements

and(@Field==2, @Field2==3,@Field3==5) - > true

cast_number

Cast column into a number

cast_number(@Field Name) - > 123

concat

Concatenates string

concat(@First Name,".",@Last Name,"/",@Country) - > "John.Doe/US"

contains

Checks whether a string contains a regex

contains("This is an example","an") - > true

exists

If the field is not null and not empty, return true

exists(@Field) - > false given Field==null

exists(@Field) - > true given Field==123

extract_regex

Extracts a capturing group regex from a string

ifnull

If the field is null, return the value

ifnull(@Field,2) - > 2 given Field==null

ifs

Allows to apply conditional statements and return a value when the statement is true. If all statements are false returns the last argument

ifs(3>4,"a",4>5,"b","c") - > c

lower

Converts string to lower case

lower("ABC") - > "abc"

not

Applies the logical not operator

not(1>2) - > true

not(10>5) - > false

now

Date time field representing when the data was synced

now() - @Created Date

or

Applies the logical or operator Allows multiple logical statements

or(@Field==2, @Field2==3,@Field3==5) - > true

pow

Calculates the exponent for a field and a power

pow(@Field,2") - > "4" given Field=2

replace

Replaces a regex within a string

split_prefix

Splits a string using the provided separator and leaves only the first element

split_prefix(@Full Name," ") - > "John"

split_suffix

Splits a string using the provided separator and leaves only the last element

split_suffix(@Full Name," ") - > "Doe"

text_join

Joins texts using the provided separator

text_join(" ",@First Name,@Last Name,@Country) -> "John Doe US"

trim

Trims string

trim(" abc ") - > "abc"

upper

Converts string to upper case

upper("abc") - > "ABC"

Creating a New Calculated Field

  1. Go to the 'Base' tab and select the decision base you would like to edit.

  2. Find the field you would like to use as a baseline for the calculation and click on the arrow button -> calculated field

  3. Name the new calculated field

  4. Define the logic for the calculated field and click on done

    1. You can add additional parameters to your calculation logic by typing the name the field you would like to use.

    2. Note that existing calculated fields can't be used when creating a new calculated field.

  5. The new field is now pending your approval

  6. You can add additional calculated fields, when you are ready click on the submit button. This will trigger the calculation process, this will take a few minutes.

    1. During the calculation process the base will be unavailable

    2. Note that existing calculated fields can't be edited

  7. You can delete an existing calculated field by clicking on the arrow button -> delete

Did this answer your question?