A Calculation field works out its value from other fields in the same record, and from fields of linked records. The value updates when the fields it uses change. Calculation fields are meant to help you stop doing the math by hand, for example a total price, the days until a deadline, or a name built from several fields.
Note:
People can't edit the result. They see it in the record, but only the calculation changes it.
A calculation can't use itself. Circular references are rejected.
Who can use the calculation field?
The calculation field is available on all plans: Free, Plus, and Premium. See what each plan includes on our pricing page.
To add or change a field, you need
Full accessto the database app and a desktop or tablet.
Add a calculation field
Open the database app and open the app menu. Its tooltip reads
Follow, export and more….Select
Customize record layout.Point at a block and click
+, or type/in a text block.Under
New field, selectCalculation.Click the drag handle (
⋮⋮) of the new field and selectEdit field.Select
Edit calculation.
Write the calculation
The window Edit calculation shows an editor with the hint Your calculation. When the editor is focused, it reads Type '@' for variables…. Type @ to insert fields of the record, properties such as the record ID, and values of linked records. Learn more about the calculation syntax →
Preview with a record
Use Preview with and Select a record to try the calculation on a real record. Type a name in Search for a record…. Below, the preview shows the result, the reason why the calculation fails, or No output if there's nothing to show.
Type shows the format of the result: None, Number, or Date. If the calculation returns a number or a date, you can switch the format here.
Editor tools
Open in fullscreenmakes the editor larger, andExit fullscreenbrings it back.cmd/ctrl+Fopens find and replace in the editor.option/alt+ click adds another cursor, so you can edit several places at once.Discard all changesappears once you've changed something. It goes back to the calculation as it was when you opened the window.Learn about calculationsopens a post about the calculation field in the Tape community.When you close the window, Tape saves your changes. In fullscreen, select
Saveto keep your changes orCancelto drop them. If you leave fullscreen another way with unsaved changes, Tape asksDiscard changes?.
Calculation field settings
In Edit field, you find:
Edit calculation: opens the editor.Format: how the result is read.Noneshows it as text. If the calculation returns a number, you can also chooseNumber. If it returns a date, you can chooseDate.Number settings(withFormatset toNumber) orDate settings(withFormatset toDate): options for showing the number or the date. Learn more about the number field → To show an amount together with a link or a button, setFormattoNone, return text, and format the number in the calculation. See an example →Trigger automationsandTrigger webhooks: decide whether a changed result starts automations and webhooks.
Calculation errors
If a calculation can't produce a value, the editor reports the reason. Some of them:
"The script returned an undefined result (undefined)"
"The result is not a valid number."
"The script ended in an infinite value (Infinity)"
"A circular dependency was detected" followed by the fields involved.
"The script was not processed in the required time"
"Syntax error" followed by the details.
The preview in Edit calculation shows these messages for the record you picked.
If a calculation runs too long, Tape stops it and marks the value as invalid. The field keeps its last value, or stays empty if it had none, and the preview shows "The script was not processed in the required time".
Learn more: The calculation field cheat sheets in the Tape community have many examples to copy:
FAQs
Can a calculation use fields of linked records?
Can a calculation use fields of linked records?
Yes, a calculation can read fields of records linked through a relation, for example the sum of all line items. Learn more about calculation syntax →
Can I use a calculation as the title of a record?
Can I use a calculation as the title of a record?
Yes, you can set a calculation field as the primary field. Learn more about the primary field →
Can a calculation return a date?
Can a calculation return a date?
Yes, once your calculation returns a date, you can set Format to Date.
Can I use the result in an automation?
Can I use the result in an automation?
Yes, automations can use the value of a calculation field, and Trigger automations lets a changed result start one. Learn more about automations →
Why is my calculation field empty?
Why is my calculation field empty?
The calculation may return a value Tape can't store, or it may have an error. Open Edit calculation and check the preview for the reason.
Are there other field types?
Are there other field types?
Yes! Database apps have fields for text, numbers, dates, members, files, relations, calculations, and more. See every field type in Intro to fields →
Still have more questions? Find answers and get help from community experts in the Tape community →.
