Applying Mathematical Calculations with Data Operation Blocks

7 min. readlast update: 03.28.2025

The Data Operation block in journeys/automations allows users to perform real-time calculations on a single event value that triggered the journey. 

The variable received from the Trigger or Goal block always corresponds to the event value that triggered the journey. Example:

  • For deposits, the variable represents the exact deposit amount recorded in the event.
  • For wagers, the variable reflects the specific wager amount from the event.
  • For lifetime based triggers or goals, the variable represents the lifetime value since customer registration (cumulative).
  • For journey accumulated based triggers or goals, the variable represents the cumulative value since the start of the journey.

 

Each event processes its own discrete value in real time, ensuring that actions and calculations are based on the latest customer interaction. Below are practical examples demonstrating how one event value can be manipulated to update customer attributes dynamically.

 


1. Adjusting a Deposit-Based Bonus

Calculate a bonus amount based on the deposited amount.

Expression:

@EventValue * 1.2

Use Case: If a customer deposits €100, the system calculates a €120 bonus (20% extra).

 


2. Setting a High-Value Transaction Flag

Tag large deposits for AML monitoring.

Expression:

@EventValue >= 5000 ? 1 : 0

Use Case: If the deposit is €5,000 or more, return 1 (flag for review); otherwise, return 0.

 


3. Accumulating Total Wagers

Alter an event value.

Expression:

@EventValue + 100

Use Case: Adds 100 to the event value.

 


4. Applying a Loss Recovery Bonus

Grant a cashback bonus based on losses.

Expression:

@EventValue * 0.10

Use Case: If a customer loses €500, they receive €50 (10%) as cashback.

 


5. Rounding a Value for Reward Tiers

Round event values to the nearest multiple of 100 for tier-based rewards.

Expression:

Round(@EventValue / 100) * 100

Use Case: A €270 deposit is rounded to €300, helping to categorise players into reward tiers.

 


6. Identifying High-Wins

Detect significant wins for risk tracking.

Expression:

@EventValue >= 2000 ? 1 : 0

Use Case: If the win amount is higher than 2000, return 1 (flag the player).

 


7. Setting Progressive Reward Levels

Assign increasing reward levels based on event value thresholds.

Expression:

@EventValue >= 10000 ? 3 : (@EventValue >= 5000 ? 2 : 1)

Use Case:

  • €10,000+ = Level 3
  • €5,000 - €9,999 = Level 2
  • Below €5,000 = Level 1

 


8. Setting Progressive Deposit Bonuses

Assign increasing reward values based on event value thresholds.

Expression:

@EventValue >= 500 ? 50 : (@EventValue >= 25 ? 10 : 0)

Use Case:

  • €500+ = €50 in bonus
  • €25 to €499 = €10 in bonus
  • Below €25 = 0

 

 


9. Assigning VIP Levels Based on Lifetime Values

The Data Operation block can be used to dynamically assign VIP levels based on the lifetime value that triggered the journey. This allows for automatic customer tiering without manual intervention.

Expression:

@EventValue >= 10000 ? 'VIP Gold' : (@EventValue >= 5000 ? 'VIP Silver' : 'VIP Bronze')

Use Case:

Automatically categorise customers based on deposits or wagers in a lifetime (since registration), or accumulated (since the start of the journye).

  • VIP Gold → Lifetime Value ≥ €10,000
  • VIP Silver → Lifetime Value between €5,000 - €9,999
  • VIP Bronze → Lifetime Value below €5,000

Example Scenarios:

  1. A customer wagers a total of €12,000 since registration  → Assigned VIP Gold
  2. A customer wagers a total of €6,500 since registration  → Assigned VIP Silver
  3. A customer wagers a total of €3,000 since registration → Assigned VIP Bronze

This dynamic segmentation ensures that VIP levels adjust in real time based on customer engagement.

 

✅ Suggest read: Automating VIP level Assignment

 

By leveraging mathemtical expressions, the Data Operation block enables real-time automation based on a single event value, allowing operators to dynamically process customer data and optimise engagement strategies within journeys.

 


Reference Library

The data operation block utilises NCalc. NCalc is a powerful expression evaluator that allows you to create dynamic formulas, rules, and logic within a data operation. To help you get started, we’ve prepared easy-to-read tables covering the most commonly used operators, functions, and expressions. Each entry is explained in plain English, so you don’t need a technical background to build smart, flexible logic for things like segmentation, bonuses, or automation rules.

 

🧮 NCalc Operators

Operator Description (Plain English) Example
+ Adds two numbers 3 + 2 = 5
- Subtracts one number from another 5 - 2 = 3
* Multiplies two numbers 4 * 2 = 8
/ Divides one number by another 10 / 2 = 5
% Gives the remainder of a division (modulo) 10 % 3 = 1
^ Raises a number to a power (exponentiation) 2 ^ 3 = 8
= Checks if two values are equal 5 = 5 returns true
!= Checks if two values are not equal 4 != 5 returns true
> Checks if the first value is greater than the second 6 > 3 returns true
>= Greater than or equal to 3 >= 3 returns true
< Less than 2 < 5 returns true
<= Less than or equal to 2 <= 3 returns true
&& "And" – true only if both sides are true true && true = true
! "Not" – flips true to false and vice versa !true = false

 

🧠 Functions

Function Description (Plain English) Example
abs(x) Gives the positive value of a number abs(-5) = 5
acos(x) Arc cosine (used in advanced math/trig) acos(1) = 0
asin(x) Arc sine asin(0) = 0
atan(x) Arc tangent atan(1) = 0.785
ceiling(x) Rounds a number up to the nearest whole number ceiling(3.2) = 4
cos(x) Cosine (used in angle calculations) cos(0) = 1
exp(x) Returns e raised to the power of x (exponential) exp(1)2.718
floor(x) Rounds a number down to the nearest whole number floor(3.7) = 3
log(x) Natural logarithm (base e) log(1) = 0
log10(x) Logarithm (base 10) log10(100) = 2
max(a, b) Returns the larger of two numbers max(4, 9) = 9
min(a, b) Returns the smaller of two numbers min(4, 9) = 4
pi() Returns the value of π (pi) pi()3.1416
pow(x, y) Raises x to the power of y (same as x ^ y) pow(2, 3) = 8
round(x) Rounds to the nearest whole number round(3.6) = 4
sign(x) Returns -1, 0, or 1 depending on whether x is negative, zero, or positive sign(-3) = -1
sin(x) Sine function (trigonometry) sin(0) = 0
sqrt(x) Square root sqrt(9) = 3
tan(x) Tangent function (angle calculation) tan(0) = 0
if(condition, trueResult, falseResult) A simple if-else logic: returns one value if the condition is true, another if not if(1 < 2, "yes", "no") = "yes"
in(value, list...) Checks if a value is in a list in(3, 1, 2, 3) = true

 

🧠 Expressions (Simplified Logic Patterns)

Expression Description (Plain English)
x > y ? a : b Returns a if x is greater than y, otherwise returns b
if(x > y, a, b) Same as above using if() function
!(condition) "Not" – reverses a true/false condition
x && y Logical AND – both x and y must be true
`x  
x = y Returns true if x equals y
x != y Returns true if x is not equal to y
x > y Returns true if x is greater than y
x >= y Returns true if x is greater than or equal to y
x < y Returns true if x is less than y
x <= y Returns true if x is less than or equal to y
x % y = 0 Returns true if x is divisible by y
in(x, a, b, c) Returns true if x matches any of the listed values (a, b, c, etc.)
x ^ y Raises x to the power of y
(x + y) * z Performs combined math using parentheses to group operations
round((a + b) * 0.1) Rounds the result of a math formula
sign(x - y) Returns -1, 0, or 1 depending on comparison between x and y

 

Was this article helpful?