PadCodedocs

Formula functions

Every function a formula can use: what it takes, what it gives back, and examples.

Functions do work inside a formula: round(total, 2), uppercase(name), count(tasks). Write the function's name, then what it works on in brackets, separated by commas. A name ending in ? can be left out. The whole language is in Formula language reference.

#How to read this page

Each table lists a function the way you write it, what it does, and what it gives back.

  • round(number, places?) takes a number and, if you like, how many decimal places. The words in brackets say what goes there; you put your own values or formulas in their place: round(total, 2).
  • ? after a word means you can leave that value out: round(total) rounds to a whole number.
  • ... means as many values as you like: max(a, b, c). min and max also take one list: max(scores).
  • it is each item of the list, in turn, inside filter, find, map, sort, any and all: filter(tasks, !it.done).
  • Text values take anything and use it as it would print, so uppercase(5) is fine. Number values must be numbers: turn typed text into one with number(…) first.
  • Dates are text like 2026-10-28 or 2026-10-28T14:30:00Z. now(), today() and the date functions give back the second form, in UTC, and formatDate writes one out for people to read.
  • Angles are in degrees, as the Rotation modifier takes them: sin(90) is 1. Colors are text like '#5B6CFF', as the color picker writes them.
  • Examples use the sample data on the formula language page: total is 120, name is "Sam", scores is [70, 95, 82, 95], tasks is a list of three tasks, and so on. Results are written the way you'd write the value in a formula: text in quotes, lists in square brackets. Money, percentages, dates and times are shown for an iPad set to English (US), in New York time.

Functions go inside each other, and the inner one is worked out first. In the Formula sheet, tap a function to add it with its opening bracket.

#Worked examples

These come from apps like an invoice maker and a to-do list. Each builds on functions from the tables below.

Add up an invoice. items is a list of records, each with qty and rate:

currency(sum(map(items, it.qty * it.rate)))

map turns each line into its amount (1 × 1200 and 4 × 85 give 1200 and 340), sum adds them up (1540), and currency writes it as money, like $1,540.00, in the iPad's currency and the way its region writes money. Add a currency code to choose one: currency(…, 'EUR').

Count what's left to do. tasks is a list of records with a True / False field done:

count(filter(tasks, !it.done))

filter keeps the tasks that aren't done, and count says how many. In text: {count(filter(tasks, !it.done))} left.

Search a list. search is the variable a Text Field keeps:

filter(products, contains(it.title, search))

contains ignores capital letters, so "phone" finds "iPhone". While search is empty, every product matches, so the whole list shows. Link a Repeater's Data to this formula to show the results.

Newest first. history is a list of records with a Date & Time field date:

sort(history, it.date, true)

The second value says what to sort by, and true puts the largest first. Dates sort by their time, so the newest comes first. first(sort(history, it.date, true)) gives only the newest record.

A due date and the days left. dueDays is a Whole Number, like 14:

formatDate(addDays(today(), dueDays), 'long')

addDays counts forward from the start of today, and formatDate writes the date out in full, the way the iPad's region writes dates. For the days left until a date variable dueDate, use daysBetween(today(), dueDate): it's negative once the date has passed.

A percentage that can't divide by zero.

percent(count(tasks) == 0 ? 0 : count(filter(tasks, it.done)) / count(tasks), 0)

With 1 task done out of 3, it gives 33%. The ? : checks for an empty list first, because dividing by count(tasks) when it's 0 is an error ("Can't divide by zero."). The last value, 0, is how many decimal places percent shows.

#Numbers

FunctionWhat it doesGives back
round(number, places?)Rounds to a number of decimal places (whole number if left out).Number
floor(number)Rounds down.Number
ceil(number)Rounds up.Number
abs(number)Drops the minus sign.Number
min(values...)The smallest of the numbers, or of a list.Number
max(values...)The largest of the numbers, or of a list.Number
clamp(number, lowest, highest)Keeps a number between two limits.Number
sqrt(number)Square root.Number
power(base, exponent)base to the power of exponent.Number
random(lowest, highest)A random whole number between the two, inclusive.Number
sign(number)-1 for a negative number, 1 for a positive one, 0 for 0.Number
trunc(number)The whole number part, dropping the decimals: trunc(-3.7) is -3.Number
log(number, base?)The logarithm: the power base must be raised to to give number. Base 10 if left out.Number
exp(number)e raised to the number.Number
pi()π, 3.14159…Number
sin(degrees)The sine of an angle in degrees: with cos, places things around a circle.Number
cos(degrees)The cosine of an angle in degrees.Number
tan(degrees)The tangent of an angle in degrees.Number
atan2(y, x)The angle in degrees from the center to the point x, y: -180 to 180.Number

#round(number, places?)

Rounds to a number of decimal places (whole number if left out).

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe number to round.NumberYes
placesHow many decimal places to keep.NumberNo: 0, a whole number

Examples

FormulaResult
round(total / 7, 2)17.14
round(2.5)3
round(-2.5)-3
round(1.005, 2)1
round(1234.5, -2)1235

Good to know

  • Halves round away from zero: 2.5 becomes 3, and -2.5 becomes -3.
  • places is itself rounded to a whole number and kept between 0 and 15. A negative places counts as 0, so round can't round to tens or hundreds.
  • Some decimals are stored a hair below what you typed, so round(1.005, 2) gives 1, not 1.01.
  • The answer is a number, so zeros at the end don't show: round(2.5, 2) gives 2.5. To show 2.50, use fixed.
  • Text isn't rounded, even when it looks like a number: round(qtyText) is an error: “round needs a number, not text.” Use round(number(qtyText)).

#floor(number)

Rounds down.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe number to round down.NumberYes

Examples

FormulaResult
floor(2.7)2
floor(-2.5)-3
floor(total / 7)17
floor(qtyText)Error: floor needs a number, not text.

Good to know

  • It always goes to the whole number below, so negative numbers move away from zero.
  • A whole number stays as it is: floor(5) gives 5.

#ceil(number)

Rounds up.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe number to round up.NumberYes

Examples

FormulaResult
ceil(2.1)3
ceil(-2.5)-2
ceil(people / 2)2
ceil(5)5

Good to know

  • It always goes to the whole number above, so negative numbers move toward zero.
  • Handy for counting whole things: tables of 2 for 3 people is ceil(people / 2).

#abs(number)

Drops the minus sign.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberAny number.NumberYes

Examples

FormulaResult
abs(-4)4
abs(4)4
abs(total - 150)30
abs(coupon)Error: abs needs a number, not null.

Good to know

  • Use it for the size of a difference, whichever way round: abs(total - 150).

#min(values...)

The smallest of the numbers, or of a list.

Gives back: Number

Takes

ValueWhat it isKindRequired
values...Numbers separated by commas, or one list of numbers.Numbers, or a listYes: at least one

Examples

FormulaResult
min(3, 1, 2)1
min(scores)70
min([])null
min(scores, 50)Error: min needs numbers, not a list.
min()Error: min(values...) can't take 0 arguments.

Good to know

  • Give it numbers or one list, not both. To include another number, put it in a list: min([50, min(scores)]).
  • An empty list gives null.
  • Text is an error, even text that looks like a number: min(['3', 2]) is an error: “min needs numbers, not text.”
  • One number on its own gives that number: min(5) gives 5.

#max(values...)

The largest of the numbers, or of a list.

Gives back: Number

Takes

ValueWhat it isKindRequired
values...Numbers separated by commas, or one list of numbers.Numbers, or a listYes: at least one

Examples

FormulaResult
max(scores)95
max(total, 100)120
max(0, total - 200)0
max([])null
max(['3', 2])Error: max needs numbers, not text.

Good to know

  • Give it numbers or one list, not both.
  • An empty list gives null.
  • max(0, x) keeps a result from going below zero.

#clamp(number, lowest, highest)

Keeps a number between two limits.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe number to keep in range.NumberYes
lowestThe smallest it may be.NumberYes
highestThe largest it may be.NumberYes

Examples

FormulaResult
clamp(15, 0, 10)10
clamp(-5, 0, 10)0
clamp(7, 0, 10)7
clamp(5, 10, 0)0

Good to know

  • Put lowest first. If lowest is bigger than highest, the answer is always highest.
  • Good for keeping a typed value inside limits: clamp(number(qtyText) ?? 1, 1, 99) gives 3.

#sqrt(number)

Square root.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe number to take the square root of.NumberYes

Examples

FormulaResult
sqrt(16)4
sqrt(2)1.4142135623730951
sqrt(0)0
sqrt(-1)nan

Good to know

  • A negative number has no square root, so the answer is “nan” (not a number). It prints as nan, and any math with it gives nan too. Check first: x >= 0 ? sqrt(x) : 0.

#power(base, exponent)

base to the power of exponent.

Gives back: Number

Takes

ValueWhat it isKindRequired
baseThe number to multiply by itself.NumberYes
exponentHow many times. Negative and decimal exponents work too.NumberYes

Examples

FormulaResult
power(2, 10)1024
power(2, -1)0.5
power(9, 0.5)3
power(10, 16)1e+16
power(-8, 1 / 3)nan

Good to know

  • A negative base with a decimal exponent gives “nan” (not a number).
  • Very big answers print in short form: power(10, 16) gives 1e+16.
  • Formulas have no ^ or ** operator: use power.

#random(lowest, highest)

A random whole number between the two, inclusive.

Gives back: Number

Takes

ValueWhat it isKindRequired
lowestThe smallest number it may give.NumberYes
highestThe largest number it may give.NumberYes

Examples

FormulaResult
random(1, 6)For example 4: any whole number from 1 to 6
random(5, 5)5
random(1.5, 3.5)For example 2: 2 or 3
random(6, 1)Error: random needs two whole numbers, the lowest first.

Good to know

  • Both ends can come up.
  • Decimals are rounded inward: lowest up and highest down. If nothing whole is left between them, like random(0.2, 0.8), it's an error.
  • It gives a new number each time the formula is worked out. To keep one, save it in a variable with a Set Value step.

#sign(number)

-1 for a negative number, 1 for a positive one, 0 for 0.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberAny number.NumberYes

Examples

FormulaResult
sign(-12)-1
sign(total)1
sign(0)0
sign(name)Error: sign needs a number, not text.

Good to know

  • With abs, it splits a change into how much and which way: abs(change) and sign(change).

#trunc(number)

The whole number part, dropping the decimals: trunc(-3.7) is -3.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberAny number.NumberYes

Examples

FormulaResult
trunc(3.7)3
trunc(-3.7)-3
trunc(total / 7)17
trunc(qtyText)Error: trunc needs a number, not text.

Good to know

  • It goes toward 0, where floor goes down: floor(-3.7) gives -4.

#log(number, base?)

The logarithm: the power base must be raised to to give number. Base 10 if left out.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberA number above 0.NumberYes
baseThe base: 10 if left out, 2 for doubling, exp(1) for e.NumberNo: 10

Examples

FormulaResult
log(1000)3
log(8, 2)3
log(total)2.079181246048
log(0)Error: log needs a number above 0, and a base above 0 that isn't 1.

Good to know

  • It answers "how many times": log(1024, 2) gives 10, the number of doublings from 1 to 1024.
  • Answers are rounded to 12 decimal places, so log(1000) is exactly 3.

#exp(number)

e raised to the number.

Gives back: Number

Takes

ValueWhat it isKindRequired
numberThe power to raise e (2.71828…) to.NumberYes

Examples

FormulaResult
exp(0)1
exp(1)2.718281828459
round(exp(2), 2)7.39
exp(name)Error: exp needs a number, not text.

Good to know

  • Answers are rounded to 12 decimal places.
  • For growth: start * exp(rate * years) is continuous compound growth.

#pi()

π, 3.14159…

Gives back: Number

Takes nothing: write the brackets with nothing between them.

Examples

FormulaResult
pi()3.141592653589793
round(pi(), 2)3.14
2 * pi() * 1062.83185307179586
pi(2)Error: pi() can't take 1 argument.

Good to know

  • A circle's length around is 2 * pi() * radius, and its area pi() * power(radius, 2).

#sin(degrees)

The sine of an angle in degrees: with cos, places things around a circle.

Gives back: Number

Takes

ValueWhat it isKindRequired
degreesAn angle in degrees: 90 is a quarter turn.NumberYes

Examples

FormulaResult
sin(30)0.5
sin(90)1
sin(180)0
sin(name)Error: sin needs a number, not text.

Good to know

  • It takes degrees, as the Rotation modifier does, not radians.
  • To put something on a circle, as a clock's numbers are, give it an Offset of sin(angle) * radius across and -cos(angle) * radius down: angle 0 is at the top, and it goes round clockwise.
  • Answers are rounded to 12 decimal places, so sin(30) is exactly 0.5.

#cos(degrees)

The cosine of an angle in degrees.

Gives back: Number

Takes

ValueWhat it isKindRequired
degreesAn angle in degrees: 90 is a quarter turn.NumberYes

Examples

FormulaResult
cos(0)1
cos(60)0.5
cos(90)0
cos(180)-1

Good to know

  • It takes degrees. With sin, it places things around a circle: see sin.

#tan(degrees)

The tangent of an angle in degrees.

Gives back: Number

Takes

ValueWhat it isKindRequired
degreesAn angle in degrees: 90 is a quarter turn.NumberYes

Examples

FormulaResult
tan(45)1
tan(0)0
round(tan(60), 3)1.732

Good to know

  • It takes degrees. Near 90 it gets very large.

#atan2(y, x)

The angle in degrees from the center to the point x, y: -180 to 180.

Gives back: Number

Takes

ValueWhat it isKindRequired
yHow far down (or up, with a minus) the point is from the center.NumberYes
xHow far right (or left, with a minus).NumberYes

Examples

FormulaResult
atan2(1, 1)45
atan2(1, 0)90
atan2(0, -1)180
atan2(-1, 0)-90

Good to know

  • It gives the angle of a point in degrees, from -180 to 180, the opposite of sin and cos.

#Text

FunctionWhat it doesGives back
uppercase(text)ALL CAPS.Text
lowercase(text)all lowercase.Text
trim(text)Removes spaces and new lines at both ends.Text
contains(textOrList, value)Whether text contains other text (ignoring case), or a list contains a value.Bool
startsWith(text, prefix)Whether text starts with other text.Bool
endsWith(text, suffix)Whether text ends with other text.Bool
slice(listOrText, start, end?)Part of a list or text, from start up to end (not included). A minus counts from the end.Any
indexOf(listOrText, value)Where a value first is in a list, or text in text (ignoring case), counting from 0; null if it isn't there.Number
padStart(value, length, padding?)The value as text, with padding (a space if left out) in front until it's length long: padStart(5, 2, '0') is "05".Text
capitalize(text)Text With Every Word Capitalized.Text
repeat(text, times)Text repeated a number of times.Text
reverse(listOrText)A list or text, back to front.Any
matches(text, pattern)Whether text matches a pattern (a regular expression) anywhere in it.Bool
urlEncode(text)Text made safe for a web address, like a search in a Call API's URL.Text
replace(text, find, replacement)Replaces every occurrence.Text
split(text, separator)Cuts text into a list at every separator.List
join(list, separator?)Joins a list into text, with a separator between items.Text
number(text)Reads a number from text; null if it isn't one.Number
text(value)Any value as text.Text

#uppercase(text)

ALL CAPS.

Gives back: Text

Takes

ValueWhat it isKindRequired
textThe text to change. Any value works, used as it prints.TextYes

Examples

FormulaResult
uppercase(name)"SAM"
uppercase('straße')"STRASSE"
uppercase(5)"5"
uppercase(coupon)""

Good to know

  • null gives empty text.
  • Letters from every language change, and some change to more than one letter, like ß to SS.

#lowercase(text)

all lowercase.

Gives back: Text

Takes

ValueWhat it isKindRequired
textThe text to change. Any value works, used as it prints.TextYes

Examples

FormulaResult
lowercase('Hello World')"hello world"
lowercase(user.name)"ada"
lowercase(isMember)"true"
lowercase(coupon)""

Good to know

  • To compare text without caring about capital letters, lowercase both sides: lowercase(name) == 'sam' gives true.

#trim(text)

Removes spaces and new lines at both ends.

Gives back: Text

Takes

ValueWhat it isKindRequired
textThe text to tidy. Any value works, used as it prints.TextYes

Examples

FormulaResult
trim(' Sam ')"Sam"
trim(' two words ')"two words"
isEmpty(trim(' '))true
trim(42)"42"

Good to know

  • It removes spaces, tabs and new lines at both ends, never in the middle.
  • Use it before checking a Text Field for something typed: isEmpty(trim(name)), so a few spaces don't count.

#contains(textOrList, value)

Whether text contains other text (ignoring case), or a list contains a value.

Gives back: Bool

Takes

ValueWhat it isKindRequired
textOrListThe text or the list to look in.Text, or a listYes
valueWhat to look for.Any valueYes

Examples

FormulaResult
contains('Grocery list', 'LIST')true
contains(scores, 82)true
contains(scores, '82')false
contains(name, '')true
contains(map(tasks, it.title), 'Pay rent')true

Good to know

  • In text, capital letters don't matter. In a list, the item must be equal, kind and capitals included, so the text '82' isn't in a list of numbers.
  • Empty text is in every text. So a search with nothing typed yet, filter(tasks, contains(it.title, search)), keeps every item.
  • Anything that isn't a list is searched as it prints: contains(1234, 23) gives true, and contains(coupon, 'x') gives false.

#startsWith(text, prefix)

Whether text starts with other text.

Gives back: Bool

Takes

ValueWhat it isKindRequired
textThe text to check. Any value works, used as it prints.TextYes
prefixWhat it should start with.TextYes

Examples

FormulaResult
startsWith('PadCode', 'Pad')true
startsWith('PadCode', 'pad')false
startsWith(startDate, '2026-10')true
startsWith(name, '')true

Good to know

  • Unlike contains, capital letters matter. To ignore them, lowercase both: startsWith(lowercase(name), 's') gives true.
  • Every text starts with empty text.

#endsWith(text, suffix)

Whether text ends with other text.

Gives back: Bool

Takes

ValueWhat it isKindRequired
textThe text to look at.TextYes
suffixThe text it might end with.TextYes

Examples

FormulaResult
endsWith(name, 'am')true
endsWith('photo.png', '.png')true
endsWith(name, 'AM')false
endsWith(total, 0)true

Good to know

  • Capital letters count. To ignore them, lowercase both: endsWith(lowercase(name), 'am') gives true.

#slice(listOrText, start, end?)

Part of a list or text, from start up to end (not included). A minus counts from the end.

Gives back: Any

Takes

ValueWhat it isKindRequired
listOrTextA list, or text.List or TextYes
startWhere to start, counting from 0. A minus counts from the end.NumberYes
endWhere to stop: that item isn't included. The end if left out.NumberNo: the end

Examples

FormulaResult
slice(scores, 1, 3)[95, 82]
slice(scores, -2)[82, 95]
slice(name, 0, 2)"Sa"
slice('PadCode', 3)"Code"
slice(scores, 3, 1)[]
slice(total, 1)Error: slice needs a list or text, not a number.

Good to know

  • The first three: slice(scores, 0, 3). The last three: slice(scores, -3).
  • Past either end is fine: it stops at the end.

#indexOf(listOrText, value)

Where a value first is in a list, or text in text (ignoring case), counting from 0; null if it isn't there.

Gives back: Number

Takes

ValueWhat it isKindRequired
listOrTextA list, or text.List or TextYes
valueWhat to look for.AnyYes

Examples

FormulaResult
indexOf(scores, 95)1
indexOf(scores, 100)null
indexOf(name, 'm')2
indexOf('Hello', 'L')2
indexOf(total, 2)Error: indexOf needs a list or text, not a number.

Good to know

  • It counts from 0, as list[0] does. Text is found ignoring capital letters.
  • Only the first is found: indexOf(scores, 95) is 1, not 3.

#padStart(value, length, padding?)

The value as text, with padding (a space if left out) in front until it's length long: padStart(5, 2, '0') is "05".

Gives back: Text

Takes

ValueWhat it isKindRequired
valueAny value, as it prints.TextYes
lengthHow long the text should be.NumberYes
paddingWhat goes in front: a space if left out.TextNo: ' '

Examples

FormulaResult
padStart(5, 2, '0')"05"
padStart(people, 3, '0')"003"
padStart(name, 5)" Sam"
padStart('12345', 3, '0')"12345"
padStart(7, 3, '')Error: padStart's padding can't be empty.

Good to know

  • Text already that long stays as it is.
  • A digital clock: padStart(hour(now()), 2, '0') + ':' + padStart(minute(now()), 2, '0'), or formatDate(now(), 'HH:mm').

#capitalize(text)

Text With Every Word Capitalized.

Gives back: Text

Takes

ValueWhat it isKindRequired
textAny text.TextYes

Examples

FormulaResult
capitalize('hello world')"Hello World"
capitalize(name)"Sam"
capitalize('ADA LOVELACE')"Ada Lovelace"
capitalize(people)"3"

Good to know

  • Each word starts with a capital, and its other letters are made small.

#repeat(text, times)

Text repeated a number of times.

Gives back: Text

Takes

ValueWhat it isKindRequired
textThe text to repeat.TextYes
timesHow many times: 0 to 10,000.NumberYes

Examples

FormulaResult
repeat('★', 3)"★★★"
repeat('★', people) + repeat('☆', 5 - people)"★★★☆☆"
repeat('ab', 0)""
repeat('★', -1)Error: repeat needs a whole number of times, from 0 to 10,000.

Good to know

  • A rating out of five, as stars, is the second example.

#reverse(listOrText)

A list or text, back to front.

Gives back: Any

Takes

ValueWhat it isKindRequired
listOrTextA list, or text.List or TextYes

Examples

FormulaResult
reverse(scores)[95, 82, 95, 70]
reverse(name)"maS"
reverse(total)Error: reverse needs a list or text, not a number.

Good to know

  • Newest first, for a list kept oldest first: reverse(history).

#matches(text, pattern)

Whether text matches a pattern (a regular expression) anywhere in it.

Gives back: Bool

Takes

ValueWhat it isKindRequired
textThe text to look at.TextYes
patternA regular expression, like '[0-9]+' for digits.TextYes

Examples

FormulaResult
matches(name, '^S')true
matches('abc123', '[0-9]+')true
matches(name, '^s')false
matches(name, '[')Error: matches can't read the pattern [.

Good to know

  • It's true when the pattern is found anywhere. To match the whole text, start it with ^ and end it with $.
  • Capital letters count.

#urlEncode(text)

Text made safe for a web address, like a search in a Call API's URL.

Gives back: Text

Takes

ValueWhat it isKindRequired
textAny text.TextYes

Examples

FormulaResult
urlEncode('coffee & cake')"coffee%20%26%20cake"
'https://example.com/search?q=' + urlEncode(name)"https://example.com/search?q=Sam"
urlEncode('a/b?c=d')"a%2Fb%3Fc%3Dd"

Good to know

  • Use it for anything typed that goes in a Call API's web address, so a space or an & doesn't break it.

#replace(text, find, replacement)

Replaces every occurrence.

Gives back: Text

Takes

ValueWhat it isKindRequired
textThe text to change. Any value works, used as it prints.TextYes
findThe text to look for.TextYes
replacementWhat to put in its place. Empty text removes it.TextYes

Examples

FormulaResult
replace('a-b-c', '-', '+')"a+b+c"
replace('Hello', 'L', 'x')"Hello"
replace(name, 'Sam', 'Ada')"Ada"
replace('1,234', ',', '')"1234"
replace('abc', '', 'x')"abc"

Good to know

  • It replaces every match, and capital letters matter.
  • Empty find text changes nothing.
  • The answer is text, even when it looks like a number: number(replace('1,234', ',', '')) gives 1234.

#split(text, separator)

Cuts text into a list at every separator.

Gives back: List

Takes

ValueWhat it isKindRequired
textThe text to cut up. Any value works, used as it prints.TextYes
separatorThe text to cut at. It isn't kept.TextYes

Examples

FormulaResult
split('a,b,c', ',')["a", "b", "c"]
split('a, b', ',')["a", " b"]
count(split('one two three', ' '))3
split('', ',')[""]
split('abc', '')["abc"]

Good to know

  • Spaces next to the separator stay with the pieces. Cut at ', ' to drop them, or trim each piece: map(split('a, b', ','), trim(it)) gives ["a", "b"].
  • Empty text gives a list with one empty text in it, so its count is 1, not 0.
  • The separator must match exactly, capital letters included. Empty separator text doesn't cut anything.

#join(list, separator?)

Joins a list into text, with a separator between items.

Gives back: Text

Takes

ValueWhat it isKindRequired
listThe list to join.ListYes
separatorWhat to put between the items.TextNo: a comma and a space

Examples

FormulaResult
join(['a', 'b'])"a, b"
join(scores, ' + ')"70 + 95 + 82 + 95"
join(map(tasks, it.title), ' · ')"Call Sam · Buy milk · Pay rent"
join([])""
join(name)Error: join needs a list, not text.

Good to know

  • Each item is used as it prints, so numbers lose .0 and null items print as nothing.
  • An empty list gives empty text.

#number(text)

Reads a number from text; null if it isn't one.

Gives back: Number

Takes

ValueWhat it isKindRequired
textThe text to read, like what's typed in a Text Field. A number works too.TextYes

Examples

FormulaResult
number(qtyText) + 14
number(' 42.5 ')42.5
number('1,000')null
number('lots') ?? 00
number(7)7

Good to know

  • It reads digits with a dot for decimals, and an optional minus. Spaces around the number are fine.
  • Commas aren't read, as thousands separators or as decimal commas: number('3,5') gives null. Remove them first with replace.
  • It gives null, not an error, when the text isn't a number, so add a fallback with ??.
  • True and false aren't numbers: number(isMember) gives null.
  • A number in short form is read too: number('1e3') gives 1000.

#text(value)

Any value as text.

Gives back: Text

Takes

ValueWhat it isKindRequired
valueAny value.Any valueYes

Examples

FormulaResult
text(3.50)"3.5"
text(isMember)"true"
text(coupon)""
text(scores)"70, 95, 82, 95"
text(people) + text(people)"33"

Good to know

  • It gives the value as it prints in text with braces: whole numbers without .0, null as empty text, a list with commas, a record in braces and quotes.
  • + already joins text with anything, so you need text mainly to join two numbers as text, or to compare: text(people) == '3' gives true.

#Formatting

FunctionWhat it doesGives back
currency(number, code?)Money, like $37.88. code is a currency code like "EUR"; the iPad's currency if left out.Text
percent(number, places?)0.18 as 18%.Text
fixed(number, places)A number with exactly that many decimals: 3.50.Text
compactNumber(number)A number made short: 1.2K, 3.4M.Text
ordinal(number)A number as a position: 1st, 2nd, 3rd.Text
plural(count, singular, plural?)A count with its word, singular or plural: 1 coffee, 3 coffees.Text
formatDuration(seconds, style?)Seconds as a time span. style: clock ("1:02:05", the default), short ("1h 2m 5s") or long.Text
formatDate(date, style?)A date as text. style: short, medium (default), long, time, relative ("in 2 days"), weekday ("Wednesday"), month ("October") or a pattern like 'HH:mm'.Text

#currency(number, code?)

Money, like $37.88. code is a currency code like "EUR"; the iPad's currency if left out.

Gives back: Text

Takes

ValueWhat it isKindRequired
numberThe amount.NumberYes
codeA three-letter currency code, like 'EUR' or 'JPY'.TextNo: the iPad's currency

Examples

FormulaResult
currency(37.88)"$37.88"
currency(sum(map(items, it.qty * it.rate)))"$1,540.00"
currency(37.88, 'EUR')"€37.88"
currency(-5)"-$5.00"
currency(qtyText)Error: currency needs a number, not text.

Good to know

  • It writes money the way the iPad's region does: the symbol, where it goes, and the separators. The code only picks the currency.
  • It rounds to the currency's own decimal places. When the amount is exactly halfway, it rounds to the even digit: currency(1540.5, 'JPY') gives "¥1,540".
  • The answer is text, for showing. Do math on the number, then format it last.

#percent(number, places?)

0.18 as 18%.

Gives back: Text

Takes

ValueWhat it isKindRequired
numberA fraction: 0.18 for 18%.NumberYes
placesExactly how many decimal places to show.NumberNo: as many as needed, up to 6

Examples

FormulaResult
percent(0.18)"18%"
percent(0.1856, 1)"18.6%"
percent(1 / 3)"33.333333%"
percent(18)"1,800%"
percent(0.125, 0)"12%"

Good to know

  • Give it a fraction: percent(18) is 1,800%. Divide by 100 first if you have a whole percentage.
  • When the value is exactly halfway, it rounds to the even digit: percent(0.125, 0) gives "12%", and percent(0.375, 0) gives "38%".
  • The answer is text, written the way the iPad's region writes percentages.

#fixed(number, places)

A number with exactly that many decimals: 3.50.

Gives back: Text

Takes

ValueWhat it isKindRequired
numberThe number to show.NumberYes
placesExactly how many decimal places to show, 0 to 15.NumberYes

Examples

FormulaResult
fixed(3.5, 2)"3.50"
fixed(1234.5, 2)"1,234.50"
fixed(total / 7, 3)"17.143"
fixed(2.5, 0)"2"
fixed(3.5, 0)"4"

Good to know

  • When the value is exactly halfway, it rounds to the even digit, unlike round: fixed(2.5, 0) gives "2", but round(2.5) gives 3.
  • It adds the region's thousands separators, and uses its decimal point.
  • The answer is text, for showing. To keep a number, use round.

#compactNumber(number)

A number made short: 1.2K, 3.4M.

Gives back: Text

Takes

ValueWhat it isKindRequired
numberAny number.NumberYes

Examples

FormulaResult
compactNumber(1234)"1.2K"
compactNumber(1500000)"1.5M"
compactNumber(total)"120"
compactNumber(name)Error: compactNumber needs a number, not text.

Good to know

  • It's in the iPad's language and region, so it fits where space is short, like a widget.

#ordinal(number)

A number as a position: 1st, 2nd, 3rd.

Gives back: Text

Takes

ValueWhat it isKindRequired
numberA whole number.NumberYes

Examples

FormulaResult
ordinal(1)"1st"
ordinal(people)"3rd"
ordinal(22)"22nd"
ordinal(11)"11th"

Good to know

  • It's in the iPad's language: a place in a race, a day of the month.

#plural(count, singular, plural?)

A count with its word, singular or plural: 1 coffee, 3 coffees.

Gives back: Text

Takes

ValueWhat it isKindRequired
countHow many.NumberYes
singularThe word for one.TextYes
pluralThe word for any other number: singular with an s if left out.TextNo

Examples

FormulaResult
plural(1, 'coffee')"1 coffee"
plural(people, 'coffee')"3 coffees"
plural(2, 'person', 'people')"2 people"
plural(0, 'task')"0 tasks"
plural(count(tasks), 'task')"3 tasks"

Good to know

  • Only exactly 1 takes the singular.

#formatDuration(seconds, style?)

Seconds as a time span. style: clock ("1:02:05", the default), short ("1h 2m 5s") or long.

Gives back: Text

Takes

ValueWhat it isKindRequired
secondsHow many seconds. A minus puts a minus in front.NumberYes
style'clock', 'short' or 'long'.TextNo: 'clock'

Examples

FormulaResult
formatDuration(90)"1:30"
formatDuration(3725)"1:02:05"
formatDuration(-90)"-1:30"
formatDuration(3725, 'short')"1h 2m 5s"
formatDuration(3725, 'long')"1 hour, 2 minutes, 5 seconds"
formatDuration(90, 'days')Error: formatDuration's style is clock, short or long, not days.

Good to know

  • A countdown: formatDuration(secondsBetween(now(), endTime)).
  • 'short' and 'long' are in the iPad's language.

#formatDate(date, style?)

A date as text. style: short, medium (default), long, time, relative ("in 2 days"), weekday ("Wednesday"), month ("October") or a pattern like 'HH:mm'.

Gives back: Text

Takes

ValueWhat it isKindRequired
dateA date, in a form the date functions read.DateYes
style'short', 'medium', 'long', 'time', 'relative', 'weekday', 'month', or a pattern of date letters like 'HH:mm'.TextNo: 'medium'

Examples

FormulaResult
formatDate(startDate)"Oct 28, 2026"
formatDate(startDate, 'short')"10/28/2026"
formatDate(startDate, 'long')"October 28, 2026"
formatDate(startDate, 'time')"10:30 AM"
formatDate(startDate, 'weekday')"Wednesday"
formatDate(startDate, 'month')"October"
formatDate(startDate, 'HH:mm')"10:30"
formatDate(startDate, 'EEE d MMM')"Wed 28 Oct"
formatDate(startDate, 'yyyy')"2026"
formatDate(startDate, 'full')Error: formatDate's style is short, medium, long, time, relative, weekday, month or a pattern like 'HH:mm', not full.

Good to know

  • It writes the date in the iPad's language, region and time zone. 2:30 PM UTC is 10:30 AM in New York, and a time early in the UTC day is still the day before there: formatDate('2026-10-28T02:00:00Z') gives "Oct 27, 2026".
  • 'relative' says how far it is from now, in words: formatDate(addDays(now(), 2), 'relative') gives "in 2 days", and formatDate(addDays(now(), -1), 'relative') gives "yesterday".
  • A plain day like '2026-10-28' is midnight where the iPad is: formatDate('2026-10-28', 'time') gives "12:00 AM".
  • Something that isn't a date is an error: formatDate('soon') is an error: “formatDate needs a date like '2026-10-28', not 'soon'.”
  • A pattern spells the date with letters: yyyy the year, MMMM the month's name (MMM short, MM its number), d the day, EEEE the weekday (EEE short), HH the hour from 0 to 23 (h from 1 to 12, with a for AM or PM), mm minutes and ss seconds. Anything else, like a space, a colon or a comma, stays as it is.

#Dates and times

FunctionWhat it doesGives back
now()This moment.Date
today()The start of today.Date
date(text)Reads a date from text like "2026-10-28", or from seconds since 1970.Date
addDays(date, days)A date some days later (or earlier, with a minus).Date
addMinutes(date, minutes)A date some minutes later.Date
daysBetween(start, end)Whole days from start to end.Number
hour(date)The hour of a date, 0 to 23, where the iPad is.Number
minute(date)The minute of a date, 0 to 59.Number
second(date)The second of a date, 0 to 59.Number
day(date)The day of the month, 1 to 31.Number
month(date)The month of a date, 1 (January) to 12.Number
year(date)The year of a date.Number
weekday(date)The day of the week, 1 (Sunday) to 7 (Saturday).Number
timestamp(date)A date as seconds since 1970, as many web APIs write it.Number
addMonths(date, months)A date some months later (or earlier, with a minus), on the same day where it can be.Date
startOf(date, unit)The start of the date's day, week, month or year.Date
secondsBetween(start, end)Whole seconds from start to end.Number
minutesBetween(start, end)Whole minutes from start to end.Number
hoursBetween(start, end)Whole hours from start to end.Number
monthsBetween(start, end)Whole months from start to end.Number
yearsBetween(start, end)Whole years from start to end: someone's age from their birthday.Number

#now()

This moment.

Gives back: Date

Takes nothing: write the brackets with nothing between them.

Examples

FormulaResult
now()For example "2026-10-31T13:41:07Z"
now() > startDatetrue
addMinutes(now(), 30) > now()true
now(1)Error: now() can't take 1 argument.

Good to know

  • It's in UTC, to the second, in the form on Dates and times.
  • It's worked out again each time the formula is, so it's the moment the formula ran. To keep a moment, like when something was added, save it with a Set Value step.
  • To show it to people, use formatDate(now(), 'time').

#today()

The start of today.

Gives back: Date

Takes nothing: write the brackets with nothing between them.

Examples

FormulaResult
today()For example "2026-10-31T04:00:00Z": midnight in New York
today() <= now()true
formatDate(today(), 'time')"12:00 AM"
daysBetween(today(), now())0

Good to know

  • It's midnight at the start of today in the iPad's time zone, written in UTC. So in New York in late October, it ends in T04:00:00Z.
  • Add days to it for a due date: addDays(today(), 14).

#date(text)

Reads a date from text like "2026-10-28", or from seconds since 1970.

Gives back: Date

Takes

ValueWhat it isKindRequired
textText holding a date, like '2026-10-28' or '2026-10-28T14:30:00Z'; or a number of seconds since 1970, as many web APIs write dates.Text or NumberYes

Examples

FormulaResult
date('2026-10-28')"2026-10-28T04:00:00Z"
date('2026-10-28T16:30:00+02:00')"2026-10-28T14:30:00Z"
date('2026-10-28T14:30:00.250Z')"2026-10-28T14:30:00Z"
date('10/28/2026')null
date('2026-10-28 14:30')null
date(1793197800)"2026-10-28T14:30:00Z"
date(1793197800000)"2026-10-28T14:30:00Z"
date(0)"1970-01-01T00:00:00Z"

Good to know

  • It reads the forms on Dates and times and gives the date in UTC, ending in Z. Anything else gives null, not an error.
  • A plain day is midnight in the iPad's time zone: in New York, '2026-10-28' becomes 4 AM UTC.
  • Use it to compare dates written in different forms: date('2026-10-28T16:30:00+02:00') == startDate gives true.
  • A number is seconds since the start of 1970 in UTC. A number too big for that, like 1793197800000, is read as milliseconds, which some APIs send. timestamp(…) turns a date back into seconds.

#addDays(date, days)

A date some days later (or earlier, with a minus).

Gives back: Date

Takes

ValueWhat it isKindRequired
dateThe date to count from.DateYes
daysHow many days to add. Use a minus to go back.NumberYes

Examples

FormulaResult
addDays(startDate, 2)"2026-10-30T14:30:00Z"
addDays(startDate, -1)"2026-10-27T14:30:00Z"
addDays('2026-10-28', 7)"2026-11-04T05:00:00Z"
addDays(startDate, 1.5)"2026-10-30T14:30:00Z"
addDays('soon', 1)Error: addDays needs a date like '2026-10-28', not 'soon'.

Good to know

  • days is rounded to the nearest whole number, so 1.5 adds 2 days. For hours, use addMinutes.
  • It keeps the time on the iPad's clock. Across a change to or from daylight saving time, the time in UTC moves by an hour: in New York, a week after midnight on October 28 is midnight on November 4, which is 05:00 UTC instead of 04:00.
  • It always gives a date and time in UTC, ending in Z, even from a plain day.

#addMinutes(date, minutes)

A date some minutes later.

Gives back: Date

Takes

ValueWhat it isKindRequired
dateThe date to count from.DateYes
minutesHow many minutes to add. Use a minus to go back; decimals add seconds.NumberYes

Examples

FormulaResult
addMinutes(startDate, 90)"2026-10-28T16:00:00Z"
addMinutes(startDate, -30)"2026-10-28T14:00:00Z"
addMinutes(startDate, 1.5)"2026-10-28T14:31:30Z"
addMinutes(startDate, 60 * 24 * 7)"2026-11-04T14:30:00Z"
addMinutes(startDate, '5')Error: addMinutes needs a number, not text.

Good to know

  • It adds exact minutes, whatever the time zone or daylight saving time, so a week of minutes can land on a different clock time than addDays(startDate, 7).
  • For hours, multiply: addMinutes(startDate, 2 * 60).

#daysBetween(start, end)

Whole days from start to end.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
daysBetween('2026-10-28', '2026-11-02')5
daysBetween('2026-11-02', '2026-10-28')-5
daysBetween(startDate, '2026-10-28T23:00:00Z')0
daysBetween('2026-10-28T23:00:00Z', '2026-10-29T01:00:00Z')0
daysBetween(startDate, 'soon')Error: daysBetween needs a date like '2026-10-28', not 'soon'.

Good to know

  • It counts calendar days in the iPad's time zone: how many midnights from start to end. The time of day doesn't matter.
  • Two times on different days in UTC can be the same day where the iPad is: 11 PM and 1 AM UTC are both on October 28 in New York, so the answer is 0.
  • It's negative when end comes first. For days left until a date, use daysBetween(today(), dueDate).

#hour(date)

The hour of a date, 0 to 23, where the iPad is.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the hour of.DateYes

Examples

FormulaResult
hour(startDate)10
hour(addMinutes(startDate, 240))14
hour(startDate) % 12 * 30 + minute(startDate) / 2315
hour('soon')Error: hour needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's where the iPad is: 2:30 PM UTC is 10:30 AM in New York. The hour is 0 to 23: 0 is midnight.
  • For an analog clock's hands, use the Clock Hand modifier: it keeps them moving on the Home Screen. As a formula, the hour hand's angle is hour(now()) % 12 * 30 + minute(now()) / 2 degrees.
  • In a widget, now() is worked out again every minute.

#minute(date)

The minute of a date, 0 to 59.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the minute of.DateYes

Examples

FormulaResult
minute(startDate)30
minute(addMinutes(startDate, 45))15
minute(startDate) * 6180
minute('soon')Error: minute needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's 0 to 59.
  • As an angle for a clock's minute hand: minute(now()) * 6 degrees, 6° a minute. The Clock Hand modifier turns a hand for you, and keeps it moving on the Home Screen.

#second(date)

The second of a date, 0 to 59.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the second of.DateYes

Examples

FormulaResult
second(startDate)0
second(addMinutes(startDate, 1.5))30
second('soon')Error: second needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's 0 to 59.
  • A widget is drawn again once a minute, so a formula with second(now()) only moves once a minute there. For a moving second hand, use the Clock Hand modifier.

#day(date)

The day of the month, 1 to 31.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the day of the month of.DateYes

Examples

FormulaResult
day(startDate)28
day(addDays(startDate, 4))1
day('soon')Error: day needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's where the iPad is: 2:30 PM UTC is 10:30 AM in New York. So a time early in the UTC day can still be the day before: day('2026-10-28T02:00:00Z') gives 27.
  • For a calendar widget's big number, show day(today()); formatDate(today(), 'weekday') names the day above it.

#month(date)

The month of a date, 1 (January) to 12.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the month of.DateYes

Examples

FormulaResult
month(startDate)10
month(addDays(startDate, 10))11
month('soon')Error: month needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's 1 for January to 12 for December. For the month's name, use formatDate(date, 'month').

#year(date)

The year of a date.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the year of.DateYes

Examples

FormulaResult
year(startDate)2026
year(addDays(startDate, 70))2027
year('soon')Error: year needs a date like '2026-10-28', not 'soon'.

Good to know

  • For someone's age in whole years from a birthday, year(today()) - year(birthday) is close; it's a year too many before the birthday comes round.

#weekday(date)

The day of the week, 1 (Sunday) to 7 (Saturday).

Gives back: Number

Takes

ValueWhat it isKindRequired
dateThe date to read the day of the week of.DateYes

Examples

FormulaResult
weekday(startDate)4
weekday(addDays(startDate, 3))7
weekday(startDate) > 1 && weekday(startDate) < 7true
weekday('soon')Error: weekday needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's 1 for Sunday to 7 for Saturday, whatever the iPad's first day of the week. For the day's name, use formatDate(date, 'weekday').
  • weekday(today()) > 1 && weekday(today()) < 7 is true on a weekday, Monday to Friday.

#timestamp(date)

A date as seconds since 1970, as many web APIs write it.

Gives back: Number

Takes

ValueWhat it isKindRequired
dateA date.DateYes

Examples

FormulaResult
timestamp(startDate)1793197800
timestamp('1970-01-01T00:00:00Z')0
timestamp('soon')Error: timestamp needs a date like '2026-10-28', not 'soon'.

Good to know

  • Many web APIs write dates as these seconds. date(…) reads them back: date(1793197800) gives "2026-10-28T14:30:00Z".

#addMonths(date, months)

A date some months later (or earlier, with a minus), on the same day where it can be.

Gives back: Date

Takes

ValueWhat it isKindRequired
dateThe date to count from.DateYes
monthsHow many months to add. Use a minus to go back.NumberYes

Examples

FormulaResult
addMonths(startDate, 1)"2026-11-28T15:30:00Z"
addMonths('2026-01-31', 1)"2026-02-28T05:00:00Z"
addMonths(startDate, -12)"2025-10-28T14:30:00Z"
addMonths(startDate, 'one')Error: addMonths needs a number, not text.

Good to know

  • It keeps the day and the time on the iPad's clock. A month after January 31 is February 28: the last day, when the month is shorter.
  • In New York, 10:30 AM on November 28 is 15:30 UTC, an hour later than in October, because the clocks change on November 1.
  • For years, add 12 months a year: addMonths(startDate, 12).

#startOf(date, unit)

The start of the date's day, week, month or year.

Gives back: Date

Takes

ValueWhat it isKindRequired
dateAny date.DateYes
unit'day', 'week', 'month' or 'year'.TextYes

Examples

FormulaResult
startOf(startDate, 'day')"2026-10-28T04:00:00Z"
startOf(startDate, 'week')"2026-10-25T04:00:00Z"
startOf(startDate, 'month')"2026-10-01T04:00:00Z"
startOf(startDate, 'year')"2026-01-01T05:00:00Z"
startOf(startDate, 'decade')Error: startOf's unit is day, week, month or year, not decade.

Good to know

  • It's midnight where the iPad is. A week starts on the iPad's first day of the week: Sunday in the US.
  • This month's entries: filter(entries, it.date >= startOf(today(), 'month')).

#secondsBetween(start, end)

Whole seconds from start to end.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
secondsBetween(startDate, '2026-10-28T14:31:30Z')90
secondsBetween('2026-10-28T14:31:30Z', startDate)-90
secondsBetween(startDate, 'soon')Error: secondsBetween needs a date like '2026-10-28', not 'soon'.

Good to know

  • It's negative when end comes first.
  • Time left on a timer: secondsBetween(now(), endTime), written for people with formatDuration.

#minutesBetween(start, end)

Whole minutes from start to end.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
minutesBetween(startDate, '2026-10-28T16:00:00Z')90
minutesBetween(startDate, '2026-10-28T14:31:30Z')1
minutesBetween('2026-10-28T16:00:00Z', startDate)-90

Good to know

  • Only whole minutes count: 90 seconds is 1 minute.

#hoursBetween(start, end)

Whole hours from start to end.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
hoursBetween(startDate, '2026-10-29T14:30:00Z')24
hoursBetween(startDate, '2026-10-28T16:00:00Z')1

Good to know

  • Only whole hours count: an hour and a half is 1 hour.
  • It counts real hours, so across a change of clocks a day can be 23 or 25 of them.

#monthsBetween(start, end)

Whole months from start to end.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
monthsBetween('2026-01-15', startDate)9
monthsBetween(startDate, '2026-12-27')1
monthsBetween(startDate, '2026-12-28T15:30:00Z')2

Good to know

  • Only whole months count, on the iPad's calendar: October 28 to December 27 is 1 month.

#yearsBetween(start, end)

Whole years from start to end: someone's age from their birthday.

Gives back: Number

Takes

ValueWhat it isKindRequired
startThe first date.DateYes
endThe second date.DateYes

Examples

FormulaResult
yearsBetween('1990-06-15', startDate)36
yearsBetween('1990-12-01', startDate)35
yearsBetween(startDate, '2020-01-01')-6

Good to know

  • Someone's age: yearsBetween(birthday, today()). Only whole years count, so it goes up on the birthday.

#Lists

FunctionWhat it doesGives back
count(listOrText)How many items in a list, or characters in text.Number
isEmpty(value)Whether a list, text or object has nothing in it, or the value is null.Bool
sum(list)Adds up a list of numbers.Number
average(list)The average of a list of numbers.Number
median(list)The middle number of a list, or the average of the two in the middle.Number
first(list)The first item, or null.Any
last(list)The last item, or null.Any
filter(list, condition)The items where condition is true. it is each item: filter(todos, !it.done).List
find(list, condition)The first item where condition is true, or null.Any
any(list, condition)Whether condition is true for any item. it is each item.Bool
all(list, condition)Whether condition is true for every item. it is each item.Bool
map(list, expression)Turns each item into something else: map(expenses, it.amount).List
sort(list, key?, descending?)Sorts a list, optionally by a key like it.date. descending is true or false.List
unique(list)The list without repeats.List
append(list, item)The list with an item added at the end.List
concat(lists...)Lists joined into one.List
shuffle(list)The list in a random order.List
keys(record)A record's field names, alphabetically.List
values(record)A record's values, in the order of keys(record).List
range(start, end)The whole numbers from start to end: range(1, 5) is [1, 2, 3, 4, 5].List

#count(listOrText)

How many items in a list, or characters in text.

Gives back: Number

Takes

ValueWhat it isKindRequired
listOrTextA list, text or a record.List, text or recordYes

Examples

FormulaResult
count(tasks)3
count(name)3
count(coupon)0
count(user)3
count(total)Error: count needs a list or text, not a number.

Good to know

  • For text, it counts characters as people see them, so an emoji with a skin tone is 1: count('👋🏽') gives 1.
  • For a record, it counts the fields. null counts as 0.
  • Numbers and true/false are an error. To count digits, use count(text(total)).

#isEmpty(value)

Whether a list, text or object has nothing in it, or the value is null.

Gives back: Bool

Takes

ValueWhat it isKindRequired
valueAny value.Any valueYes

Examples

FormulaResult
isEmpty(nickname)true
isEmpty(coupon)true
isEmpty(tasks)false
isEmpty(' ')false
isEmpty(0)false

Good to know

  • Empty text, an empty list, a record with no fields and null are empty. Numbers and true/false never are, not even 0.
  • Spaces count as something: use isEmpty(trim(name)) to treat a few spaces as empty.

#sum(list)

Adds up a list of numbers.

Gives back: Number

Takes

ValueWhat it isKindRequired
listA list of numbers.ListYes

Examples

FormulaResult
sum(scores)342
sum(map(items, it.qty * it.rate))1540
sum([])0
sum([1, '2'])Error: sum needs numbers, not text.
sum(1, 2)Error: sum(list) can't take 2 arguments.

Good to know

  • An empty list adds up to 0.
  • Every item must be a number. To add up a field, map it first: sum(map(items, it.qty)) gives 5.
  • To add a few numbers, use +, or put them in a list: sum([1, 2]).

#average(list)

The average of a list of numbers.

Gives back: Number

Takes

ValueWhat it isKindRequired
listA list of numbers.ListYes

Examples

FormulaResult
average(scores)85.5
average([1, 2, 6])3
average([])null
round(average([1, 2, 2]), 1)1.7
average(map(tasks, it.title))Error: average needs numbers, not text.

Good to know

  • An empty list gives null, since there's nothing to divide. Add a fallback: average([]) ?? 0 gives 0.
  • The answer keeps every decimal, so round it to show it.

#median(list)

The middle number of a list, or the average of the two in the middle.

Gives back: Number

Takes

ValueWhat it isKindRequired
listA list of numbers.ListYes

Examples

FormulaResult
median(scores)88.5
median([3, 1, 2])2
median([])null
median(tasks)Error: median needs numbers, not an object.

Good to know

  • The middle of the numbers in order, or the average of the two in the middle. Unlike average, one very big or small number doesn't pull it far.

#first(list)

The first item, or null.

Gives back: Any

Takes

ValueWhat it isKindRequired
listAny list.ListYes

Examples

FormulaResult
first(scores)70
first(tasks).title"Call Sam"
first([])null
first(coupon)Error: first needs a list, not null.
first(name)Error: first needs a list, not text.

Good to know

  • An empty list gives null, and so does any field read from it: first([]).title gives null.
  • null itself is an error, which matters while an API's answer hasn't loaded. Give a fallback list: first(coupon ?? []) gives null.

#last(list)

The last item, or null.

Gives back: Any

Takes

ValueWhat it isKindRequired
listAny list.ListYes

Examples

FormulaResult
last(scores)95
last(tasks).title"Pay rent"
last([])null
last(split('a/b/c', '/'))"c"

Good to know

  • An empty list gives null; null itself is an error, like first.

#filter(list, condition)

The items where condition is true. it is each item: filter(todos, !it.done).

Gives back: List

Takes

ValueWhat it isKindRequired
listThe list to look through.ListYes
conditionA formula worked out for each item, with it as the item. The item stays when it's true.ConditionYes

Examples

FormulaResult
filter(scores, it > 80)[95, 82, 95]
map(filter(tasks, !it.done), it.title)["Buy milk", "Pay rent"]
count(filter(tasks, it.done))1
filter([], it > 1)[]
filter(coupon, it)Error: filter needs a list, not null.

Good to know

  • The condition uses what counts as true, so filter(list, it) keeps the items that aren't empty, 0, false or null.
  • The items keep their order.
  • Inside, it is this function's item, even inside Repeat for Each's steps. Other names, like your variables, work as usual: filter(scores, it > total - 40) gives [95, 82, 95].

#find(list, condition)

The first item where condition is true, or null.

Gives back: Any

Takes

ValueWhat it isKindRequired
listThe list to look through.ListYes
conditionA formula worked out for each item, with it as the item.ConditionYes

Examples

FormulaResult
find(tasks, !it.done).title"Buy milk"
find(scores, it > 90)95
find(scores, it > 100)null
find(tasks, it.title == 'Walk dog').title ?? 'Not found'"Not found"

Good to know

  • It stops at the first item where the condition is true.
  • When nothing matches, it gives null, and reading a field from that gives null too, so a ?? after it covers both.

#any(list, condition)

Whether condition is true for any item. it is each item.

Gives back: Bool

Takes

ValueWhat it isKindRequired
listAny list.ListYes
conditionA formula that's true or false for each item, with it as the item.True / FalseYes

Examples

FormulaResult
any(scores, it > 90)true
any(tasks, it.done)true
any(scores, it > 100)false
any([], it > 0)false

Good to know

  • It's the same as count(filter(list, condition)) > 0, and stops at the first item that's true.

#all(list, condition)

Whether condition is true for every item. it is each item.

Gives back: Bool

Takes

ValueWhat it isKindRequired
listAny list.ListYes
conditionA formula that's true or false for each item, with it as the item.True / FalseYes

Examples

FormulaResult
all(scores, it >= 70)true
all(tasks, it.done)false
all([], it > 0)true

Good to know

  • Everything done: all(tasks, it.done). An empty list counts as all done.

#map(list, expression)

Turns each item into something else: map(expenses, it.amount).

Gives back: List

Takes

ValueWhat it isKindRequired
listThe list to go through.ListYes
expressionA formula worked out for each item, with it as the item. Its answers make the new list.Any formulaYes

Examples

FormulaResult
map(scores, it / 5)[14, 19, 16.4, 19]
map(tasks, it.title)["Call Sam", "Buy milk", "Pay rent"]
map(items, it.qty * it.rate)[1200, 340]
map(range(1, 3), it * it)[1, 4, 9]
map([], it * 2)[]

Good to know

  • The new list has as many items as the old one, in the same order.
  • A map inside a map has its own it, so the inner one can't see the outer item.

#sort(list, key?, descending?)

Sorts a list, optionally by a key like it.date. descending is true or false.

Gives back: List

Takes

ValueWhat it isKindRequired
listThe list to sort.ListYes
keyA formula worked out for each item, with it as the item, to sort by.Any formulaNo: the items themselves
descendingtrue for largest first.True / FalseNo: false

Examples

FormulaResult
sort(scores)[70, 82, 95, 95]
sort(scores, it, true)[95, 95, 82, 70]
map(sort(tasks, it.title), it.title)["Buy milk", "Call Sam", "Pay rent"]
sort(['b', 'B', 'a'])["B", "a", "b"]
sort(scores, true)[70, 95, 82, 95]

Good to know

  • The second value is always the key. sort(scores, true) sorts every item by the same key, true, so nothing moves: for largest first, write sort(scores, it, true).
  • Numbers sort by size and text character by character, so capital letters come first. To ignore them, sort by lowercase(it.title).
  • Dates written the same way sort in time order.
  • Items that tie keep their order.
  • Kinds that can't be compared sort as numbers, then text, then true/false, then lists and records, with null last: sort([3, 'a', null, true, 1]) gives [1, 3, "a", true, null]. Descending flips this order too, so null comes first: sort([1, null, 3], it, true) gives [null, 3, 1].

#unique(list)

The list without repeats.

Gives back: List

Takes

ValueWhat it isKindRequired
listAny list.ListYes

Examples

FormulaResult
unique(scores)[70, 95, 82]
unique(map(tasks, it.done))[true, false]
unique([1, '1', 1.0])[1, "1"]
count(unique(scores))3
unique([])[]

Good to know

  • It keeps the first of each, in order.
  • Items are repeats only when they're equal, kind and capitals included: the number 1 and the text '1' are different.

#append(list, item)

The list with an item added at the end.

Gives back: List

Takes

ValueWhat it isKindRequired
listAny list.ListYes
itemWhat to add at the end.AnyYes

Examples

FormulaResult
append(scores, 60)[70, 95, 82, 95, 60]
append([], name)["Sam"]
append(name, 'x')Error: append needs a list, not text.

Good to know

  • It works out a new list. To change a list variable, use an Add to List step.

#concat(lists...)

Lists joined into one.

Gives back: List

Takes

ValueWhat it isKindRequired
listsTwo or more lists.ListYes

Examples

FormulaResult
concat(scores, [1, 2])[70, 95, 82, 95, 1, 2]
concat([1], [2], [3])[1, 2, 3]
concat(scores, 5)Error: concat needs lists, not a number.

Good to know

  • For one item, append reads better: append(scores, 60).

#shuffle(list)

The list in a random order.

Gives back: List

Takes

ValueWhat it isKindRequired
listAny list.ListYes

Examples

FormulaResult
count(shuffle(scores))4
sort(shuffle(scores))[70, 82, 95, 95]
shuffle(scores)For example [82, 70, 95, 95]
shuffle(name)Error: shuffle needs a list, not text.

Good to know

  • It's a new order each time it's worked out. A random pick: first(shuffle(tasks)).

#keys(record)

A record's field names, alphabetically.

Gives back: List

Takes

ValueWhat it isKindRequired
recordA record, like one from an API.RecordYes

Examples

FormulaResult
keys(user)["address", "age", "name"]
keys(user.address)["city"]
keys(scores)Error: keys needs an object, not a list.

Good to know

  • They're in alphabetical order, the same order values uses.

#values(record)

A record's values, in the order of keys(record).

Gives back: List

Takes

ValueWhat it isKindRequired
recordA record.RecordYes

Examples

FormulaResult
values(user.address)["London"]
values(user)[{"city":"London"}, 36, "Ada"]
values(name)Error: values needs an object, not text.

Good to know

  • In the order of keys(record): alphabetical by field name.

#range(start, end)

The whole numbers from start to end: range(1, 5) is [1, 2, 3, 4, 5].

Gives back: List

Takes

ValueWhat it isKindRequired
startThe first number.NumberYes
endThe last number, included.NumberYes

Examples

FormulaResult
range(1, 5)[1, 2, 3, 4, 5]
range(-2, 2)[-2, -1, 0, 1, 2]
range(3, 1)[]
range(0.5, 3.5)[1, 2, 3]
range(1, 20000)Error: range can make at most 10,000 numbers.

Good to know

  • It counts up by 1. When end is smaller than start, the list is empty.
  • Decimals are rounded inward: start up and end down.
  • Use it with map to make lists: map(range(1, 3), 'Item ' + it) gives ["Item 1", "Item 2", "Item 3"].

#Other

FunctionWhat it doesGives back
uuid()A new unique id, for new list items.Text
typeOf(value)What kind of value it is: number, text, bool, list, record or null.Text
parseJSON(text)Reads JSON text into values: records, lists, numbers and text.Any
toJSON(value)A value written as JSON text.Text
rgb(red, green, blue, opacity?)A color from red, green and blue (0 to 255) and opacity (0 to 1): "#5B6CFF".Text
mix(color, otherColor, amount)A color between two: amount 0 is the first, 1 the second.Text

#uuid()

A new unique id, for new list items.

Gives back: Text

Takes nothing: write the brackets with nothing between them.

Examples

FormulaResult
uuid()For example "3f2b8c1e-9a4d-4c7b-8e2f-1a6d5c9b0e47"
count(uuid())36
uuid() == uuid()false

Good to know

  • Each one is new, in lowercase letters and numbers with dashes.
  • Use it to give a new list item an id of its own, so steps can find that item later, like Update in List with a Where of it.id == params.id.

#typeOf(value)

What kind of value it is: number, text, bool, list, record or null.

Gives back: Text

Takes

ValueWhat it isKindRequired
valueAny value.AnyYes

Examples

FormulaResult
typeOf(total)"number"
typeOf(name)"text"
typeOf(isMember)"bool"
typeOf(scores)"list"
typeOf(user)"record"
typeOf(coupon)"null"
typeOf(qtyText)"text"

Good to know

  • Something typed is text, even when it's digits: read it with number(…).
  • A date is text too.

#parseJSON(text)

Reads JSON text into values: records, lists, numbers and text.

Gives back: Any

Takes

ValueWhat it isKindRequired
textJSON, as text.TextYes

Examples

FormulaResult
parseJSON('[1, 2]')[1, 2]
parseJSON('{"city": "Paris"}'){"city":"Paris"}
parseJSON('true')true
parseJSON('nope')Error: parseJSON needs JSON text, not 'nope'.

Good to know

  • Call API and Load File read JSON already. This is for JSON that arrives as text, like a value someone pasted or one an API sent inside text.

#toJSON(value)

A value written as JSON text.

Gives back: Text

Takes

ValueWhat it isKindRequired
valueAny value.AnyYes

Examples

FormulaResult
toJSON(scores)"[70,95,82,95]"
toJSON([true, null])"[true,null]"
toJSON(total)"120"

Good to know

  • A record's fields come out in alphabetical order.

#rgb(red, green, blue, opacity?)

A color from red, green and blue (0 to 255) and opacity (0 to 1): "#5B6CFF".

Gives back: Text

Takes

ValueWhat it isKindRequired
red0 to 255.NumberYes
green0 to 255.NumberYes
blue0 to 255.NumberYes
opacity0 (clear) to 1 (solid).NumberNo: 1

Examples

FormulaResult
rgb(91, 108, 255)"#5B6CFF"
rgb(255, 0, 0, 0.5)"#FF000080"
rgb(300, -5, 0)"#FF0000"
rgb(scores, 0, 0)Error: rgb needs a number, not a list.

Good to know

  • Use it anywhere a color goes, through a formula: a background that changes with a value.
  • Numbers past 0 to 255 are held to it.

#mix(color, otherColor, amount)

A color between two: amount 0 is the first, 1 the second.

Gives back: Text

Takes

ValueWhat it isKindRequired
colorA color like '#22C55E'.ColorYes
otherColorAnother color.ColorYes
amount0 is the first color, 1 the second, 0.5 halfway.NumberYes

Examples

FormulaResult
mix('#FF0000', '#0000FF', 0.5)"#800080"
mix('#000000', '#FFFFFF', 0.25)"#404040"
mix('#22C55E', '#EF4444', 0)"#22C55E"
mix('red', '#FFFFFF', 0.5)Error: mix needs colors like '#5B6CFF', not 'red'.

Good to know

  • Green to red as time runs out: mix('#22C55E', '#EF4444', 1 - secondsLeft / 1500).
  • Colors are written as '#RRGGBB' or '#RRGGBBAA', as the color picker writes them.