Formulas in a journey
Data from another system does not always fit your design. A journey can prepare the fields of a card before it is printed.
Formula
A Formula step computes fields, like a spreadsheet. Give the field a name, for example firstName, and write the formula:
FIRSTNAME(recipient.name)While you type, the step suggests functions and fields, shows the help of the function you are in and the result with the sample card of the test drive.
| You want | Formula |
|---|---|
| The first name from a full name | FIRSTNAME(recipient.name) gives Jan from Jan van der Berg |
| The surname with its prefix | LASTNAME(recipient.name) gives van der Berg |
| A greeting with a fallback | IF(ISBLANK(firstName), "Dear customer", "Dear " & firstName) |
| Capitals for each word | PROPER(city) |
| A date two weeks later | DATEADD(orderDate, 14, "days") |
| A date as text | FORMATDATE(orderDate, "d MMMM yyyy", "nl") |
Name a field by its name, or recipient.city, externalId or metadata.campaign. Join text with &. A formula that fails leaves its field empty.
Lists
When a design has a list, for example the orders of a customer, a formula and a decision can use it:
| You want | Formula or field |
|---|---|
| The number of orders | COUNT(orders) or the field orders.count |
| The total amount | SUM(orders, "amount") or orders.sum.amount; also AVG, MIN and MAX |
| The product of the first or last order | FIRST(orders, "product"), LAST(orders, "product") or orders.first.product |
In a decision, orders.count compares as a number, and a field of the entries such as orders.product matches when any order matches: equals A5 holds when one of the orders is A5, does not equal A5 when none is. A webhook answer that holds an array is kept as a list, so the next steps and the design can use it.
Map fields
Copy, move, set or remove fields, for example when a source sends voornaam and your design uses firstName.
Lookup table
Translate a value through a table, for example a store code into the store name, with a fallback when nothing matches.
Label
Add labels to the card. Decisions can use them and the export shows them.
Find fields and functions
Where a step asks for a field, choose it from the list: the fields of the designs the journey sends, the fields earlier steps fill and the fields every card has. You can also type a field the card brings itself; a field nothing knows gets a notice.
Choose Fields and functions above the journey, or the button next to an input, to open the inspector on the left. Fields lists every field the step can use, Functions every formula function with its explanation. A click puts it into the input you worked in last.
Open a support ticket in the portal. Tell us what you tried and, if you can, which item or Postbatch it is about.