Expressions and formatters
Expressions and formatters let you go beyond simple placeholders — you can transform, format, and compute values directly inside your {{...}} tags.
- Formatters transform a value: change its casing, format it as currency, display a date in a specific format, and more.
- Expressions compute a value: perform arithmetic, concatenate strings, or return different text based on a condition.
You can also combine both — compute a value with an expression, then format the result.
Formatters
Formatters are applied to a placeholder using the pipe (|) character:
{{data.fieldName | formatterName}}
Some formatters accept parameters:
{{data.fieldName | formatterName(param1, param2)}}
String formatters
| Formatter | Description | Example |
|---|---|---|
uppercase | Converts text to upper case | {{data.name | uppercase}} |
lowercase | Converts text to lower case | {{data.name | lowercase}} |
capitalize | Capitalizes the first letter | {{data.name | capitalize}} |
titleCase | Capitalizes the first letter of each word | {{data.name | titleCase}} |
truncate(length) | Truncates text and adds ... | {{data.description | truncate(20)}} |
truncate(length, suffix) | Truncates text with a custom suffix | {{data.description | truncate(20, "---")}} |
replace(search, replacement) | Replaces all occurrences of a string | {{data.code | replace("-", "")}} |
padStart(length, character) | Pads the beginning to reach the given length | {{data.invoiceNo | padStart(6, "0")}} |
padEnd(length, character) | Pads the end to reach the given length | {{data.code | padEnd(10, ".")}} |
join(separator) | Joins list items into a single string | {{data.tags | join(", ")}} |
Number formatters
| Formatter | Description | Example |
|---|---|---|
currency(code) | Formats as currency using the locale associated with the currency code | {{data.total | currency("EUR")}} |
currency(code, decimals) | Formats as currency with a specific number of decimal places | {{data.total | currency("GBP", 0)}} |
number(decimals) | Formats a number with the given decimal places | {{data.price | number(2)}} |
number(decimals, decimalSep, thousandSep) | Formats a number with custom separators | {{data.total | number(2, ",", ".")}} |
round(decimals) | Rounds to the given number of decimal places | {{data.tax | round(2)}} |
ceil | Rounds up to the nearest integer | {{data.qty | ceil}} |
floor | Rounds down to the nearest integer | {{data.qty | floor}} |
abs | Returns the absolute value (removes the sign) | {{data.balance | abs}} |
The currency formatter automatically applies the correct symbol and number format for the given currency code. Supported codes include EUR, USD, GBP, JPY, and any other standard currency code.
Date formatters
The date formatter displays a date in a specific format:
{{data.date | date("DD/MM/YYYY")}}
Some common format examples:
| Format string | Output for a date like 2026-03-28 14:30 |
|---|---|
DD/MM/YYYY | 28/03/2026 |
MMMM DD, YYYY | March 28, 2026 |
YYYY-MM-DD HH:mm:ss | 2026-03-28 14:30:00 |
ddd, MMM DD | Sat, Mar 28 |
dddd | Saturday |
hh:mm A | 02:30 PM |
Date format tokens
| Token | Description | Example |
|---|---|---|
YYYY | Four-digit year | 2026 |
MMMM | Full month name | March |
MMM | Abbreviated month name | Mar |
MM | Month number, zero-padded | 03 |
DD | Day of month, zero-padded | 05 |
dddd | Full day name | Saturday |
ddd | Abbreviated day name | Sat |
HH | Hours (24-hour), zero-padded | 14 |
hh | Hours (12-hour), zero-padded | 02 |
mm | Minutes, zero-padded | 30 |
ss | Seconds, zero-padded | 00 |
A | AM / PM | PM |
a | am / pm | pm |
Single-letter variants (M, D, H, h, m, s) work the same way but without zero-padding. YY gives a two-digit year.
Default value
The default formatter provides a fallback value when a field is missing or undefined:
{{data.missingField | default("N/A")}}
If the field exists, its value is used as normal. If it is missing, the default value is returned instead.
Chaining formatters
You can chain multiple formatters by adding more pipes. Formatters are applied from left to right:
{{data.fieldName | formatter1 | formatter2 | formatter3}}
For example:
{{data.name | default("n/a") | uppercase}}— falls back to"n/a"if missing, then converts to upper case.{{data.balance | abs | currency("EUR")}}— removes the sign, then formats as EUR currency.{{data.tax | round(2) | number(2, ",", ".")}}— rounds to 2 decimal places, then formats with custom separators.{{data.name | uppercase | truncate(5)}}— converts to upper case, then truncates.{{data.missing | default(0) | currency("EUR")}}— falls back to0if missing, then formats as EUR currency.
Expressions
Expressions let you compute values inside your placeholders instead of just referencing a field.
Arithmetic
You can use standard arithmetic operators:
| Operator | Description | Example |
|---|---|---|
+ | Addition | {{data.subtotal + data.tax}} |
- | Subtraction | {{data.price * data.quantity - data.discount}} |
* | Multiplication | {{data.price * data.quantity}} |
/ | Division | {{data.total / data.count}} |
% | Modulo (remainder) | {{data.total % 3}} |
Use parentheses to control the order of operations:
{{(data.price + data.fee) * data.quantity}}
String concatenation
Use + to join strings together:
{{data.firstName + " " + data.lastName}}
Comparisons and conditional values
Use the ternary operator to return different values based on a condition:
{{data.total > 100 ? "High" : "Low"}}
| Operator | Meaning |
|---|---|
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
== | Equal to |
!= | Not equal to |
More examples:
{{data.status == "paid" ? "Paid" : "Pending"}}
{{data.discount != 0 ? "Discounted" : "Full price"}}
Built-in functions
Built-in functions perform common operations on your data.
Aggregate functions
These functions work on a list (array) of objects. You pass the field name and the list:
| Function | Description | Example |
|---|---|---|
sum(field, list) | Sum of values | {{sum("price", data.items)}} |
min(field, list) | Smallest value | {{min("price", data.items)}} |
max(field, list) | Largest value | {{max("price", data.items)}} |
average(field, list) | Average value | {{average("price", data.items)}} |
count(list) | Number of items | {{count(data.items)}} |
Conditional and validation functions
| Function | Description | Example |
|---|---|---|
iif(condition, ifTrue, ifFalse) | Returns a value based on a condition (alternative to the ternary operator) | {{iif(data.total > 100, "High", "Low")}} |
isNullOrEmpty(value) | Returns true if the value is null, undefined, or empty | {{isNullOrEmpty(data.missing) ? "N/A" : data.missing}} |
Expression and built-in function results can be piped into formatters the same way as regular fields — for example:
{{data.price * data.quantity | currency("EUR")}}— computes the total, then formats it as currency.{{sum("price", data.items) | currency("EUR")}}— sums all prices, then formats the result as currency.