Skip to Content
FormulasComing from Coda

Fundamento formulas and Coda

If you are moving tables from Coda, most of what you know carries over: formulas are written as function calls (Filter(...), ForEach(...), If(...)), tables and columns are referenced by name, and a formula column sees each row’s values already typed.

The two engines differ in one principle. Coda tries to make a formula work whatever you give it. Fundamento tells you when a formula mixes things that do not belong together (comparing text with a number, adding text to a number), and does exact arithmetic on decimals. The rules are closer to a spreadsheet such as Excel than to Coda, with function names and organization that stay close to Coda’s. Conditions are the exception: If and friends read a value as true or false exactly as Coda does.

Everything on this page about Coda was observed by running formulas in Coda (English locale).

The differences at a glance

CodaFundamento
NumbersBinary floating pointExact decimals
0.1 + 0.2 == 0.3falsetrue
1 / 3 * 3 == 1truetrue
Text that looks like a number, compared with a numberRead as a number ("1" = 1 is true)Never equal ("1" == 1 is false)
"10" > "9"true (compared as numbers)false (compared as text, "1" sorts before "9")
"10" > 9trueError: text and number
"a" = "A"falsefalse
"5" + 16Error: text and number
"abc" + 1abc1Error: text and number
Text column used as a numberConverted silentlyConvert it with Number
If(0, ...), If("", ...), If("abc", ...), If("false", ...)0 and empty text are false, the rest true (the text "false" too)Same
Equality operator=== (and the function Equals)
ToNumber("abc")Returns the text abcError
Blank number in arithmetic00
Where a value comes from a columnTyped by the columnTyped by the column

The sections below explain each row.

Numbers

Coda stores every number as a binary floating point value, the same as most programming languages. Some decimals cannot be stored exactly, so tiny errors appear:

FormulaCodaFundamento
0.1 + 0.20.300000000000000040.3
0.1 + 0.2 == 0.3falsetrue
19.99 * 1001998.99999999999981999
Round(1.005, 2)11.01
1 / 30.33333333333333330.333333333333333 (15 significant digits shown)
1 / 3 * 311

Fundamento keeps decimals exact, so amounts such as prices, tax and totals add up without a Round to hide the noise. A result with a repeating decimal, such as 1 / 3, is shown with 15 significant digits but keeps its exact value, so 1 / 3 * 3 is still 1.

All numbers have one type. There is no separate whole-number type, so 5 and 5.0 are the same value.

Comparing values

==, !=, <, <=, > and >= follow one rule: both sides must be the same kind of value.

  • Two numbers, two pieces of text, two true/false values, two dates or two durations compare normally.
  • == and != between different kinds are never equal, with no error: "1" == 1 is false, true == 1 is false.
  • <, <=, > and >= between different kinds are an error that names both kinds, and the column when the value comes from a table. Ordering a piece of text against a number has no sensible answer, so Fundamento says so instead of returning false.
  • Text comparison is case-sensitive: "a" == "A" is false, and uppercase letters sort before lowercase ones. To ignore case, convert both sides with Lower or Upper.
  • Equals(a, b) does exactly what a == b does.

In Coda, text that looks like a number is read as a number when compared. So "1" = 1, "1" = "1.0" and "10" > "9" are all true, and "abc" > 5 is false instead of an error. Fundamento does not guess: if a column holds numbers as text, convert it with Number, for example Number(CurrentRow("Quantity")) > 5.

Cells in a Number or Decimal column are numbers already, so they need no conversion.

Lists

Two lists are equal when they have the same elements in the same order, and the elements follow the rules above. List(1, 2) == List("1", "2") is true in Coda and false in Fundamento, because 1 and "1" are different kinds of value.

To compare lists like these, convert one side so both hold the same kind, using ForEach. Pick the kind that suits your data:

// Compare as numbers: turn the text into numbers List(1, 2) == ForEach(List("1", "2"), Number(CurrentValue)) // Compare as text: turn the numbers into text ForEach(List(1, 2), Concatenate(CurrentValue)) == List("1", "2")

Both are true. Number reports an error for an element that is not a plain number, naming the value, so a stray "abc" in the list is found instead of making the comparison quietly false. Converting to text with Concatenate never fails, but the text you compare against must then be written exactly as the number is shown: a number 1.5 becomes "1.5", so it does not equal the text "1.50". Compare as numbers when the values are amounts, because then "1.50" and 1.5 are equal.

Text and numbers in arithmetic

In Coda "5" + 1 is 6, and "abc" + 1 is the text abc1. In Fundamento + between a number and text is an error, because it is usually a column that holds text where a number was intended:

Error: cannot add Text (column "Quantity" holds "abc", not a valid number) to a number
  • Add numbers with +, join text with + or Concatenate.
  • Turn text into a number with Number. It accepts plain numbers such as 42, -3.5 and 1000, and reports an error for anything else, including an empty cell, a number with a thousands separator or a decimal comma, and "1e3".
  • Number("abc") is an error. Coda returns the text unchanged.

Blank values

A blank number cell counts as 0 in arithmetic (blank + 1 is 1), as in Coda. In a comparison a blank number is not 0: blank == 0 is false, and IsBlank(blank) is true. Use IfBlank to choose the value you want.

True and false

Booleans are only equal to booleans: true == 1 and true == "true" are false, as in Coda. In arithmetic Coda reads true + 1 as 2; in Fundamento that is an error. Use If(CurrentRow("Done"), 1, 0) to count a checkbox.

Conditions

The condition of If, the arguments of And, Or and Not, the condition of Filter, All and Any, the condition of an action such as UpdateRows, and the case and accent options of ContainsText, StartsWith and EndsWith all follow one rule, the one Coda uses for conditions (Coda is stricter about the three options, which must be true or false):

ValueCounts as
false, a blank cell, 0, empty textfalse
any other number, any other text (" ", "0", "abc", "false"), a date, a durationtrue
a list or an objectan error: it is not clear whether an empty one is false

So If(CurrentRow("Quantity"), ...) is false when the quantity is 0 or blank, and the text "false" counts as true, as in Coda, JavaScript and Python. Ruby is the odd one out here: it also treats 0 and "" as true. To read the text of a column as true or false, use ToBoolean.

And, Or and Not always return true or false, never one of their arguments.

Converting to true or false

ToBoolean turns a value into true or false, and is the counterpart of Number and ToDate. Unlike a condition it is strict. It accepts:

ValueResult
true, falseunchanged
the text "true" or "false", in any case ("True", "TRUE")true or false
the text "t" or "f", in any casetrue or false
the number 1 or 0true or false

Anything else, including 2, "yes", "1" and a blank cell, is an error that names the value. A checkbox column already holds true or false, so it needs no conversion.

If(ToBoolean(CurrentRow("Approved")), "Go", "Hold")

Dates and durations

Date and duration columns arrive in a formula as dates and durations, as in Coda, and Date + Duration, Date - Date and Duration * number behave the same way: see Dates, durations and time zones.

Two differences:

  • Text is never read as a date: Date(2024, 1, 1) == "2024-01-01" is false in both. Convert with ToDate first.
  • A plain number is not a duration. Coda reads Days(1) = 1 as true; in Fundamento Days(1) == 1 is false. Write Days(1). Date + 1 and Date - 1 move a date by whole days in both, but a date-time plus a number is an error: write DateTime + Hours(5).

Where the formula language differs

CodaFundamento
Equality===
Join text&+ or Concatenate
Call a function on a valueColumn.Function() as well as Function(Column)Function(value) only
Current rowthisRowCurrentRow("Column")
Whole tablethe table’s nameTable("Table")

Function names

Fundamento names its functions in the same style as Coda, and groups them in the same way (collection, logical, string, date, duration, table, document and user functions). Filter, ForEach, If, IfBlank, Upper, Lower, Join, Concatenate, Today, Now, Date, DateTime, Days, Hours, Round and many more are called the same, so a formula written for Coda needs only the changes on this page. The full list is the reference.

A function that has no Coda counterpart, or that Coda has and Fundamento does not yet, is not mentioned here. If you miss one, tell us.

Moving a Coda formula: a checklist

  1. Replace = with == and & with +.
  2. Write Function(value) instead of value.Function(), and CurrentRow("Column") instead of thisRow.Column.
  3. Wrap text that holds a number in Number(...) before doing arithmetic or ordering with it.
  4. Replace duration = 1 and date-time + 5 with an explicit duration such as Days(1) or Hours(5).
  5. Remove Round(x, 2) calls that only existed to hide floating point noise. They are harmless, but no longer needed.
Last updated on