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
| Coda | Fundamento | |
|---|---|---|
| Numbers | Binary floating point | Exact decimals |
0.1 + 0.2 == 0.3 | false | true |
1 / 3 * 3 == 1 | true | true |
| Text that looks like a number, compared with a number | Read 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" > 9 | true | Error: text and number |
"a" = "A" | false | false |
"5" + 1 | 6 | Error: text and number |
"abc" + 1 | abc1 | Error: text and number |
| Text column used as a number | Converted silently | Convert 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 abc | Error |
| Blank number in arithmetic | 0 | 0 |
| Where a value comes from a column | Typed by the column | Typed 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:
| Formula | Coda | Fundamento |
|---|---|---|
0.1 + 0.2 | 0.30000000000000004 | 0.3 |
0.1 + 0.2 == 0.3 | false | true |
19.99 * 100 | 1998.9999999999998 | 1999 |
Round(1.005, 2) | 1 | 1.01 |
1 / 3 | 0.3333333333333333 | 0.333333333333333 (15 significant digits shown) |
1 / 3 * 3 | 1 | 1 |
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" == 1is false,true == 1is 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 withLowerorUpper. Equals(a, b)does exactly whata == bdoes.
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.5and1000, 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):
| Value | Counts as |
|---|---|
false, a blank cell, 0, empty text | false |
any other number, any other text (" ", "0", "abc", "false"), a date, a duration | true |
| a list or an object | an 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:
| Value | Result |
|---|---|
true, false | unchanged |
the text "true" or "false", in any case ("True", "TRUE") | true or false |
the text "t" or "f", in any case | true or false |
the number 1 or 0 | true 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) = 1as true; in FundamentoDays(1) == 1is false. WriteDays(1).Date + 1andDate - 1move a date by whole days in both, but a date-time plus a number is an error: writeDateTime + Hours(5).
Where the formula language differs
| Coda | Fundamento | |
|---|---|---|
| Equality | = | == |
| Join text | & | + or Concatenate |
| Call a function on a value | Column.Function() as well as Function(Column) | Function(value) only |
| Current row | thisRow | CurrentRow("Column") |
| Whole table | the table’s name | Table("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
- Replace
=with==and&with+. - Write
Function(value)instead ofvalue.Function(), andCurrentRow("Column")instead ofthisRow.Column. - Wrap text that holds a number in
Number(...)before doing arithmetic or ordering with it. - Replace
duration = 1anddate-time + 5with an explicit duration such asDays(1)orHours(5). - Remove
Round(x, 2)calls that only existed to hide floating point noise. They are harmless, but no longer needed.