Coda — thisRow, currentValue, Step01
Wordings differ, similarities are striking, but all three are different
No — they are not the same!
I want to have this clear before anything else, but they all play a comparable role. All three are about items in lists and their related properties we work with. That said, we start our story.
Items in a list we evaluate
Relational data only makes sense when you relate data and this exactly what these concepts do:
thisRow
currentValue
step 1 Result
We discuss similarities based on 3 examples you find in the example below.
thisRow
— the most often used reference
When we relate data living on the same row we apply the thisRow
logic, even when we do not mention it explicitly. Below the code you write in the editor, you do not see the thisRow.
Below the pasted version that shows the thisRow
reference and thus the applied chaining. The object — as discussed in the previous blog — contains all info living on this row and by adding a specific reference, we extract that data point from the object thisRow
.
Once you see this and you keep in mind the logic of initial sorting, you also understand what happens in the context of a previousRow
. In that scenario you link to a data point not living on the row you are working in, but on another row, a row preceding ‘thisRow’
in a sorting. More about this in my previous blog.
currentValue — when it appears
In our example snippet you observe two main principles:
- thisTable
- currentvalue.birthdayDate
When you write thisTable you reference all items in the display column. In other words you reference a list of all objects in the table.
In the above the currentvalue
replaces the thisRow
and since you evaluate all items, the result is based on all these objects. As you can see in the screenshot, the outcome has more than 55 rows.
The currentValue is not only used to reference all objects in a table, but also to reference all items in a list. Such lists appear in tables, on the canvas and in automations.
We start with a straightforward currentValue logic:
As you see, we turn each first name, each item, into an item with capitals using Upper()
. In the above the items do not represents objects. What you see is what you get. A list of items and each item is evaluated by the function Upper()
and when not Upper()
yet, it is made Upper().
It happens that a currentValue does reference a number that relates to a position of an item in a list. This is shown in the example below.
First we reference all objects in the table DB Greek and via chaining we ask for the letter and here we take the first value applying Slice()
. So far so good.
Once we have this list on the canvas we can for example ask for any third letter as you see in the preparation below. We count the items in the list and in the next step this currentValue is applied to reference the position of a letter. I use WithName()
. In short this is giving a name to any outcome of a formula and here the outcome is a number, the count of the Greek letters.
The currentValue below is not the item in the list with letters, but as said the position of the letters (the items) in the list. The result is that we have 8 letters.
In short: a currentValue references something:
- an object you can chain (with the dot),
- a simple item (text, number) ,
- the position of an item in a list
It constructs for you a relation. Something alike happens in automations, have a look.
Automations and Steps
It is a bit confusing at first when you start with Coda automations and you have to use steps to get somewhere in scenarios whereby data is coming in.
We have a ModifyRows
based on a new form entry and it looks like below. It does something simple, it makes sure that the Gender starts with a capital.
When we paste the above snippet into a code block, we see something more: the thisRow
reference is introduced again.
thisRow.[Step 1 Result].ModifyRows(
[Employee Information Table].Gender,
thisRow.[Step 1 Result].Gender.Substitute(
thisRow.[Step 1 Result].Gender.Slice(1,1),
thisRow.[Step 1 Result].Gender.Slice(1,1).Upper())
)
That is a bit of a surprise, isn’t it? At least, for me it was. I assumed that only the step 1 result
would be sufficient, apparently not. It looks like the automations have a (virtual) position inside the table enabling them to reference thisRow
(thus the object) and chaining the object — via the dot — to a value that lives in the automation using the step 1 result (or step 2, 3 and so forth results).
In most of my automations I only use step 1 results. I like to keep my docs and my automations as simple as possible.
An automation is triggered by the change of data in a table OR by time:
- Row changed
- Time-based
- Form submission
- Webhook invoked
When time changes, you likely want to have certain buttons pressed for example to notify or email a user. Only in this scenario a step 1 Result is not relevant. In the other triggers, the step 1 result is about the new data (form submission, webhook invoked) or about data that changes in a table after a human intervention. Coda bots do not listen to changes as a result of other Coda bots. We need humans I wrote in this blog.
The step 1 result resembles a currentValue as an object in the list of objects that arrives in the doc via the automation or is spotted due to a human intervention. The chaining links firstthisRow
to the Step 1 result
and second to the lists in the referenced table. This chaining explains the two dots you see in the code snippet.
thisRow.[Step 1 Result].Gender.Substitute()
Summary
All three are about items in lists and their related properties. The thisRow
is about objects. Chaining presents you the related properties living in columns in the same or in another table. Currentvalues is a bit more diverse. It often relates to a list of objects, but can also represent simple items in a list of names or dates or anything simple and last but not least it also can be used to point to positions of items in lists. These multiple options make the currentValue the hardest of the three to understand and apply. Last but not least, the Step 1 results
is the bridge between thisRow
and the properties in the referenced table.
Once you understand this logic and you combine it with the principles of the previous blog on filtering & sorting, you are good to go for many formulas and you can handle most cases. You can even understand how the solutions provided by calculate column are built up and you can — may it be necessary — improve them to fit your purpose.
My name is Christiaan and blog about Coda. Since the summer of 2023 mainly about how to Coda with AI to support organisations dealing with texts and templates. My blogs are for beginners and experienced users. The central theme is that in Coda everything is a list.
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. You find my (for free) contributions to the Coda Community and on Twitter.
Coda comes with a set of building blocks ー like pages for infinite depth, tables that talk to each other, and buttons that take action inside or outside your doc ーso anyone can make a doc as powerful as an app (source).
Not to forget: the Coda Community provides great insights for free once you add a sample doc.