Formulas and Expressions
Formulas let you compute derived values from DataPool fields. Use them in data bindings, triggers, and component inputs to transform and combine data.
Syntax
Formulas use a simple expression syntax. Reference DataPool fields using their full path:
{stream.item.field}Arithmetic
| Operator | Description | Example |
|---|---|---|
+ | Addition | {sales.north.revenue} + {sales.south.revenue} |
- | Subtraction | {sales.north.revenue} - {sales.north.costs} |
* | Multiplication | {metrics.rate} * 100 |
/ | Division | {sales.north.revenue} / {sales.north.target} |
% | Modulo | {counter.value} % 10 |
() | Grouping | ({a} + {b}) / 2 |
String Operations
| Function | Description | Example |
|---|---|---|
concat(a, b, ...) | Join strings | concat({first_name}, " ", {last_name}) |
upper(s) | Uppercase | upper({status}) |
lower(s) | Lowercase | lower({email}) |
trim(s) | Remove whitespace | trim({input}) |
left(s, n) | First n characters | left({code}, 3) |
right(s, n) | Last n characters | right({code}, 4) |
replace(s, find, rep) | Replace substring | replace({text}, "old", "new") |
length(s) | String length | length({name}) |
Number Functions
| Function | Description | Example |
|---|---|---|
round(n, d) | Round to d decimal places | round({pct}, 1) |
floor(n) | Round down | floor({score}) |
ceil(n) | Round up | ceil({score}) |
abs(n) | Absolute value | abs({change}) |
min(a, b) | Smaller value | min({actual}, {target}) |
max(a, b) | Larger value | max({actual}, {target}) |
clamp(n, lo, hi) | Constrain to range | clamp({temp}, 0, 100) |
Conditional
| Function | Description | Example |
|---|---|---|
if(cond, then, else) | Conditional value | if({sales} > {target}, "Above", "Below") |
Formatting
| Function | Description | Example |
|---|---|---|
format(n, pattern) | Number formatting | format({revenue}, "#,##0") |
formatDate(d, pattern) | Date formatting | formatDate({timestamp}, "dd MMM yyyy") |
currency(n, code) | Currency formatting | currency({price}, "GBP") |
percent(n, d) | Percentage formatting | percent({ratio}, 1) outputs "85.3%" |
Lookup
| Function | Description | Example |
|---|---|---|
lookup(table, key) | Lookup table reference | lookup("Statuses", {status}) |
lookup(table, key, default) | With default value | lookup("Colours", {level}, "#grey") |
Examples
Percentage of target
round(({sales.north.revenue} / {sales.north.target}) * 100, 1)Conditional status text
if({sensors.temperature} > 35, "HIGH", if({sensors.temperature} < 10, "LOW", "NORMAL"))Formatted currency
concat(currency({sales.total}, "GBP"), " of ", currency({sales.target}, "GBP"))Dynamic colour based on performance
if({sales.pct} >= 100, "#27ae60", if({sales.pct} >= 80, "#f39c12", "#c0392b"))Formulas are evaluated in real time as DataPool values change. There is no manual refresh — bound elements update automatically.
Last updated on