Photo by Jessica Burnett on Unsplash

Named Formulas in a Canvas Column

Coding Coda faster due to a table with formulas

Christiaan Huizer
4 min readJul 6, 2022

--

In larger projects I keep track of multiple and complex variables. Inside a column, button or canvas function we have the WithName() to literally rename a (complex) formula and to store temporarily values we need later on. The name we give helps to see what the output is about. When it is a number, I’ like to use a (part of a) word that tells me so, like PeopleCount. The right wording matters to me to keep the code understandable.

It happens I have to write functions several times in a very like wise manner. Certainly in buttons that reference one table as source table. One button can be used for calculating the overtime, one for the holiday leave, one for the sick leave and they all use the same source table. Evidently quite some data like the month, the employees etc come back over and over again.

In these scenarios named formulas are of great help, they output the values you need without retyping the same function and on top, it is faster. Your doc only calculates once and the user applies the outcome more than once.

At first I started to use named canvas formulas on page named accordingly with a proper icon. This page became messy and it showed all the outcomes like all the active employees in the active month, that can be a long list for a company with 100+ people at work.

The Formula Tables

Below a screenshot of the first part of the Table General with test data. I have like wise tables for holidays, sick leave, over time and so on. From the outside the main characteristics are:

  • The Name explains in human language what the row is about
  • The NamedFormula presents the name of the named formula. You notice they all start with an underscore. The main reason is that these functions become part of the list with standard functions like List(), Filter(), Contains() etc. and you don’t want to scroll through the combination of your named functions and the formal Coda functions. The underscore gives you direct access to all your named functions not in alphabetcial order but in order of creation (which is a bit silly à mon avis).
  • the Formula is a canvas column that contains the actual function, more about that later on.
  • The Status tells me if the function is actively used in my document ✅ or broken 🔴 or to check ❓ or in blue if the code works, but I don’t use the function in the document (yet) 🟦. Blue is meant to be temporarily.

The Inside of the canvas column

The magic happens inside the canvas column. Not only do I have the canvas column in which the named function lives, but I also designed the appearance to support my future self. Below you see how this goes.

In the column Details I write the context of the function, sometimes I add screenshots and write out step by step how the complex named formula got constructed for my future self. The buttons do what they promise to do, they help me to move forward, backward expand or even leave this modus. Over time I appeared that this set up worked best for me.

Once the project is running and the daily review is no longer require as it is in the building and testing phase, I disable the display preview function. As such the outcomes are not printed on the canvas, which speeds up further the calculation. This cannot be done on a normal page.

Templating

All these named formulas not only live in buttons, but also play a role in templates I construct. In this case the main output is a printed salary slip people take home. No fancy email, no doc sharing, simple print.

Although the image is maybe to small to see well, the first part contains many named formulas which are rather easy to use as such. The right part of the screenshots shows a blue and green status, over time the blue will be removed, the green one is the better variation I easily could generate via duplicating the row.

Templating with named formulas

I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter

My name is Christiaan and I support SMB with calculations (budgets and planning) and I prefer using Coda to get the job done.

Not to forget: the Coda Community provides great insights for free once you add a sample doc.

Christiaan on “Named Formulas in a Canvas Column”

--

--

Christiaan Huizer

I write about Coda.io - AI and (HR )planning challenges. You find blogs for beginners and experienced makers. I publish about once per week. Welcome!