Skip to main content

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

FormatterDescriptionExample
uppercaseConverts text to upper case{{data.name | uppercase}}
lowercaseConverts text to lower case{{data.name | lowercase}}
capitalizeCapitalizes the first letter{{data.name | capitalize}}
titleCaseCapitalizes 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

FormatterDescriptionExample
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)}}
ceilRounds up to the nearest integer{{data.qty | ceil}}
floorRounds down to the nearest integer{{data.qty | floor}}
absReturns 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 stringOutput for a date like 2026-03-28 14:30
DD/MM/YYYY28/03/2026
MMMM DD, YYYYMarch 28, 2026
YYYY-MM-DD HH:mm:ss2026-03-28 14:30:00
ddd, MMM DDSat, Mar 28
ddddSaturday
hh:mm A02:30 PM

Date format tokens

TokenDescriptionExample
YYYYFour-digit year2026
MMMMFull month nameMarch
MMMAbbreviated month nameMar
MMMonth number, zero-padded03
DDDay of month, zero-padded05
ddddFull day nameSaturday
dddAbbreviated day nameSat
HHHours (24-hour), zero-padded14
hhHours (12-hour), zero-padded02
mmMinutes, zero-padded30
ssSeconds, zero-padded00
AAM / PMPM
aam / pmpm

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 to 0 if 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:

OperatorDescriptionExample
+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"}}
OperatorMeaning
>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:

FunctionDescriptionExample
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

FunctionDescriptionExample
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}}
tip

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.