Workflows
Functions
Change a value before you use it – round a number, change capitals, split text or read the date.
Both text and expression fields can use these functions, written with _. in front:
| Function | What it does | Example |
|---|---|---|
_.upper, _.lower | Change to capitals or small letters | _.upper(postcode) |
_.len | Count the items in a list, or the characters in text | _.len(rows) > 0 |
_.as_int, _.as_float, _.as_str | Turn a value into a whole number, a decimal or text | _.as_int(quantity) |
_.round_num | Round a number | _.round_num(total, 2) |
_.fmt | Format a number, such as with two decimal places | _.fmt("%.2f", total) gives 42.50 |
_.replace | Replace part of some text | _.replace(phone, " ", "") |
_.split, _.join | Split text into a list, or join a list into text | _.join(", ", names) |
_.get | Read a value by its path – a path that doesn’t exist is an error | _.get(order, "items[0].name") |
_.json_parse, _.json_stringify | Turn JSON text into a value, or a value into JSON text | _.json_parse(raw) |
_.now | The current date and time as text, in a timezone and format you choose | _.now("Europe/London", "%d %b %Y") |
_.random_choice, _.random_num | Pick at random | _.random_choice(["Hi", "Hello"]) |
In text, put a function inside the curly brackets – {_.upper(name)} – or after the value as a filter – {name|upper}. See Logic in text.