A formula is an expression that returns one result for a note. It can read the note’s properties and notes reached through relationships. It is not general-purpose JavaScript: it cannot fetch a URL, modify another note, or run arbitrary scripts.

Write values and property names

ValueExample
Number1200, 3.5, -2
Text"Drafting"
Checkboxtrue, false
Missing valueempty
Datedate("2026-12-31")
List[1, 2, 3]
PropertyWords
Property with spacesprop("Target words")

Choose a property from the editor’s list, and it goes in as a chip. The formula keeps the property itself, not its name: rename the property and the formula follows it, and a new property given the old name is not read in its place.

Operators

OperationSyntaxExample
Arithmetic+, -, *, /, %, ^Words / Target * 100
Compare==, !=, <, <=, >, >=Words >= Target
Both conditions&&Target > 0 && Words >= Target
Either condition||Done || Words >= Target
Not!!Done
Conditionalcondition ? yes : noDone ? "Ready" : "Draft"

Use parentheses to make grouping explicit. For example, (Words + 500) / Target adds before dividing. ^ raises to a power and comes before *: 2 * 3 ^ 2 is 18. % is the remainder, and keeps the sign of the number you divide by: -1 % 7 is 6, which is what counting around a week needs. Text and numbers are different types; use format or toNumber when you mean to convert.

To choose among several values, use ifs with tests, or switch with values to match, instead of nesting if:

ifs(Words >= Target, "Done", Words > 0, "Started", "Not started")
switch(Status, "Draft", 1, "Review", 2, 0)

Each gives its last value when nothing matches, or empty when there is no last value.

Empty is different from zero

An absent value is empty. Zero is a number, false is a checkbox, and "" is empty text.

  • isEmpty recognizes empty, empty text, and empty lists.
  • coalesce chooses the first value that is not absent. It keeps 0, false, empty text, and empty lists.
  • compact removes absent list entries while keeping 0, false, and empty text.

For truth tests, zero, empty text, empty lists, false, and empty are false. Other values are true. Use an explicit comparison when that distinction affects the meaning of a formula.

Functions and method notation

Many operations can be written with the value as the first argument or before the function name:

sum([1, 2, 3])
[1, 2, 3].sum()

The function reference gives each function’s syntax and examples. A question mark in a signature marks an optional argument; an ellipsis means more arguments are accepted.

Lists and relationships

Lists contain one kind of value, optionally including empty entries. Mixing text and numbers in a list is an error. A relationship is a list of related notes, even when its picker allows only one selection.

Passages.Words.sum()
Tasks.filter(t => !t.Done)

The name before => represents one item at a time. In the second example, t.Done reads that task’s Done property. Filter keeps matching items; map transforms each item; find returns the first matching item or empty.

Name an intermediate result

Use let … in … to make a longer expression easier to read:

let remaining = Target - Words in max(remaining, 0)

The name is local to the expression. It does not create a property or change the note.

Leave a comment

Write a comment between /* and */. It can go anywhere a space can, and run over several lines:

/* words still to write, never below zero */
let remaining = Target - Words in max(remaining, 0)

The formula reads the comment as nothing. It is kept exactly where you wrote it, through every save, rename, export and Format. There is no // comment: on a formula written on one line, it would hide everything after it.

Dates and time

today() returns a date without a time. now() includes the current time. dateAdd(Due, 1, "months") moves a date on the calendar, keeping its time; dateBetween(Due, today(), "days") counts the whole days until it. Units are words: "days", "weeks", "months", "hours". A letter such as "M" is refused, since it means months in one language and minutes in another.

A date minus a date is a duration, elapsed time: inHours(Finished - Started) reads it as hours, and formatDuration draws it as 2 hr 30 min or 2:30. A date plus a duration is a later moment. A date plus a number is refused, because a number is a day in some languages and nothing in others: write dateAdd(Due, 1, "days"). Around a clock change, one calendar day need not equal 24 elapsed hours, and the two are kept apart.

Date formats change presentation; they do not change the underlying date’s meaning.

A formula result is calculated

The rule is saved and synced; its result is derived from the current inputs. A display prefix, suffix, or decimal setting changes how the result is drawn. It does not change the value another formula reads.