Geek Culture
Published in

Geek Culture

How To Coda?

How to Coda?

If you — like me — have no background in coding, the options Coda provides may feel overwhelming. Certainly in the beginning when all you have is blank page staring at you. And there are tables and formulas, many many formulas.

How to make use of Coda?

I like this question better than ‘what is Coda?’ I use Coda to keep track of daily health related measurements, to write reports in, to calculate on investments, to present a team, to structure a meeting, as an assistant on birthdays of friends & family, to plan a weekend, to manage the inventory of my business, to inform bus drivers which bus to take for with trip, to ask their passengers for feedback and so on.

When I create a d o c (c o d a) I use my laptop, when I check something on the go, I use my phone. Creating means I open a doc, give it name and start writing something or I create directly a table to enter or order (copied) data. The skills required for setting up a doc are specific, though not difficult compared to what we have to go through in College ;-)

Corporate America, explained

Tables and lists of data

Once you belong to the working class a spreadsheet seems too much for many. At least measured by the messy and incomprehensible clutter I got in my inbox previously.

The virtue of any spreadsheet became its vice: ease of use.

Don’t get me wrong, also a Coda doc can be messed up. In the Coda Community you see requests that are a one way ticket to disappointment. Mainly caused by a lack of understanding how Coda tables operate.

After you have read this article and understood the main principles, it is quite likely you can put your docs in order!

3 key principles to Coda

These principles will make it easier to Coda. Besides images I also link to posts in the community I deem valuable. Reading this blog is only the starter, the insights don’t speak to you unless you Coda. We start with the most profound learning of all: in Coda it is all about lists of data.

1— Lists of data

Everything is a list. In case a table has 10 rows, then any column in that table has 10 items in a list. If one row is empty, it is still an (empty) item in this list. Cells in rows can contain one item (like your birthday) or multiple items (like all classmates having their BD in August). In any spreadsheet, cells can only contain one item. One or multiple in Coda, we call it an item. Next, every item has a position in the list. We use Nth() to point it. CurrentValue is an item in a list (which can contain multiple values itself) in a current position. Which position is not the right question because it can be any position, depending on the formula. When you use Last(), you have the last position in a list, thus of all the items in a column, First() is the first position. Min() and Max() are not about positions, they are about values like the age of somebody, or weight, or people in a team. In short a column contains a list of items we can calculate with.

Below is what happens if you ask for the thisTable. You see People names and City names in the same table as the outcome of the same formula. It is the display column that makes the difference. The display column holds the reference to all information in that row.

The Display Column at work

The most right image shows also that this table has 10 rows. Via thisTable.Count() we count the rows in the table, using the display column without mentioning it explicitly.

The thisTable formula itself wraps up all the items found in the display column and creates a list shown on each row. It shows a list within a list and that 10 times. 10 items in each cell, because we have 10 rows.

Below you see a comparable result based on a few steps:

  • We created a select list and linked it to the table Members
  • We selected per group one or more members
  • In the column ‘as a list’ we pulled them together via List() and the result is that you see items in brackets once that part of the list contains multiple items. Brackets indicate lists.

With multiple lists in one cell, you cannot (easily ) work. You need to straighten them out before you can ask for related information. The List() logic keeps the inner lists in place, while the ListCombine() puts all items in a single list.

Below you see how this works and how we via referring to the index in the table Members, pull in additional information. Based on this linked data you see the First via First(), the Last using Last() and the Max in which I apply Max() . Notice that number 10 in row 3 is the first item (Celine). The 10 refers to the last row in the table where we find Celine.

The above kind of lists is different from the list generated by the amount of rows in a table you get via thisTable.Count()

When you write thisTable or the name of a table in a formula, you get the values back of the display column. That is practical and permits for example to AddOrModifyRows() in other tables rather easily. This is possible because Coda provides a kind of virtual number to each Row, that is the number in light grey you might have seen before each row in any table.

When you want to manipulate data that lives in one cell you do not have such a virtual number. Instead you have to generate it yourself. Mostly this is done via Sequence() as you can see below.

Dates — as you can see — numbers with properties. Below we count the weekdays by combining Contains() and Not(). We take all days and exclude number 1 (Sunday) and 7 ( Saturday).

Sequence(thisRow.From,thisRow.To).Filter(CurrentValue.Weekday().
Contains(1,7).Not()).Count()

Examples to see how the list logic is applied:

In this article I focus specifically on the list aspect of Coda.

2— thisRow versus thisTable

When we want to check if an item that lives on this row matches with another item in that list (column) we apply a filter. We first take all items in the column Category by adding thisTable, next we filter this list with the values in that same list via Contains(thisRow).

Since each row contains a relation with other data that lives in the same row, we can ask for it.

It is worthwhile to check if you are looking for values in thisTable or specific on thisRow. Below are some examples. It is a subject that often comes back and in many variations in the community.

3— Chaining Columns

In the previous part I mentioned the chaining logic when I picked up the RowIndex based on the name of the member that was a lookup to the source table.

The principle of adding related data-sets (columns) is key to Coda and comes back in various ways. Maybe you have seen it already as part of the menu in the tables when adding a column. Once you click on one of the proposed options, the formula behind appears.

Tables and data in tables remain connected, they are relational. If I replace Antwerp with Rotterdam, it will change everywhere.

The proposed LookUps are actually filters based on a thisRow() logic. Below a variation that relates to the same table that directly caught my attention when I got started with Coda. It is a nice way to create a team hierarchy for example.

There is a subtlety you should keep an eye on when you implement something like this. The moment you change you display column, the logic you had put in place changes. The right image shows that Laura became Hasselt and that is because Hasselt is the city linked to Laura and cities became the Display Column.

You cannot circumvent this.

To avoid confusion I often use a RowIndex as a Display Column. The RowIndex is a list of numbers starting at one and then up to the number as there are rows in the table and based on thisTable.Find(thisRow). For more info check this article. Numbers are useful to calculate with, not so much show and this makes them for me a good choice when linking data.

Linking data using buttons — once you see the logic of chaining — is in reach for anyone. Below is an example I noticed in the community . It splits courses over rows related to the teacher mentioned by a number in the display column. So each number represents a teacher and a few of them give the same courses. English as a class seems populair by the way. Numbers can be replaced by names. This will not change the functioning or the formula.

I rewrote the above formula a bit to highlight the structure:

First the display column is automatically referenced the moment you use the Table name. When you FormulaMap the table, you FormulaMap the display column. The result I named ‘thisTeacher’ so keep in mind the teacher on each row. Second I link each CurrentValue named as thisTeacher to the items in the list Courses. Pay attention, this is not the standard list, this is a list in a cell. The outcome is something like:

  • teacher one, with class 1,
  • teacher one, with class 2,
  • teacher two, with class 1,
  • teacher two with class 2,
  • teacher two with class 3,
  • etc.

The outcome I named thisClass to keep in mind the reference to each row. When you press the button, each row gets the related values.

No further complexity is required, other than chaining values.

For those who want to give it a shot, this is the formula to copy — paste into your doc.

[Teacher Schedule].FormulaMap(CurrentValue.WithName(thisTeacher,thisTeacher.Courses.FormulaMap(CurrentValue.WithName(thisClass,Schedules.AddRow(Schedules.Teacher,thisTeacher,Schedules.Class,thisClass)))))

When you distribute over new rows, chaining is simple and highly efficient. See also the application of the chaining logic in this article on keeping stock up to date (inventory management).

This chapter on chaining is not so much on chaining functions like :

=Orders.Filter(Product ='Jacket’).Cost.Sum()

Reading from right to left is something you need to learn. I just read my blog again and noticed that I assumed that this kind of chaining is self evident. Maybe I am mistaken and if so, don’t hesitate to give me a shout!

tables are a view of data

Extra — Views

First you have data and second your view of data. A pie chart is a visual representation of a data set in a table. Grouping, Cards, Forms and so on are all variations on the same theme: views of data living in a table. So when you have one table with all the days in a year and you want a second table with only the first day of each month this could very well be a view of the same table with an active filter. Below and above some views of the same table.

Same table, this time in Card View

How to Coda?

Let’s get back to the title of the blog: “how to Coda”? I wrote this in a positive normative manner implying there are better and worse ways to set up a doc. I hope that after reading and practicing ideas from this blog you create beautiful and meaningful docs in no time! I believe everybody can Coda. Not so much because I learned it, but because the formula language is written in such a way, that is easy to learn. See also this article of Matt Hudson.

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 Huizer and I am the owner of Huizer Automation. A company specialized in serving SME in harvesting data and keeping it aligned. I mainly rely on Coda, Mailjet, Zapier & Paperform to get the job done.

Huizer Automation on how to Coda

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christiaan Huizer

Christiaan Huizer

I use Coda mainly for planning & calculations of all sorts. Follow me to learn how to Coda with numbers. I blog at least once per week.