Sequence of instructions in a formula (beginner)

I’m struggling to learn the basics of formulas, i.e. how to write them properly. I’m so slow to get the “syntax”, or how to articulate the formulas items that I find it disturbing about my “logical” capacity.

So this question is essentially a pretext to learn.
For example: I have a button in a column of a table.
If I click on it, it updates a status in another column of the same table.
ModifyRows(thisRow, TableName.Status, “Later”)

I’ve been trying for hours to make that clicking the button again will cancel the action (i.e. Status=“blank”, I guess).
I’ve tried to accumulate several ModifyRows in the same formula, but I don’t even know if you can accumulate these instructions.
And I don’t know if I should use SwitchIf instead (and sorry for all my confusion).

In other words, how are the instructions chained?
Should I put another “ModifyRows” somewhere? Or should I use only one, separated by commas? Or do you chain them together with dots?
I find the formula page to be a great “Reminder” of how to use formulas, but the document is (for me at least!) way too succinct to learn something.

Anyway, I’m willing to be put on the track a bit, and i thank you for that.

PS: In a way, it would be great to have a kind of playground like here, but I’m not sure how it would be possible or feasible…

HI Gabriel,

Welcome to Coda! I hope you will soon write formulas with ease.

This doc has a number of examples on various Coda topics, including formulas:

The document seems to be quite popular, so I have started building a more organised one, specifically around the formulas in Coda. It is still very much a Work in Progress, but I give examples of each formula in use on the canvas, and in a table. I also have a section where I compare formulas that are similar, e.g. around rounding, or generating random items. Hopefully this doc is less “succinct”… :wink:

For your question, have a look at this page:

It shows the formula RunActions() in use. (But on second thoughts, maybe you do not even need RunAction(), If() could be enough.)

It is approaching sleep time where I am, so I will give you some hints only:
What I would do is have a button with an If() formula. In the If() formula, you will then have two sections, one to populate the column, another to make it blank. Each of those would set an indicator column whether the button has been clicked “on or off”.

I have done something similar, but using two buttons:

The first button does some work, and then sets the Data Exploded indicator to “Yes”.

To undo the work, there is another button that will undo the work, and then set the indicator to “No”. While this is done using two buttons, it could just as well have been done using If(), the logic of the two buttons included as the then and else parts of the If().

As for a playground - you can just play in your Coda doc.

Ask if there is anything unclear, if I am not immediately available, somebody else in the community will step in.

Rambling Pete


Seems like you want the button to toggle the state of the “Status” field. You’re on the right path with ModifyRows(thisRow, TableName.Status, ...). What you can do is conditionally set the value the “Status” will be set to based on its current value. If there are only two states, say “Later” and [blank], then you can just check if it is one and set it to the other. Something like:

ModifyRows(thisRow, TableName.Status, SwitchIf([thisRow].Status, "", "Later", "Later", "")).

If there are more possible states, it depends what you want to do.

1 Like

Wow, Piet, thanks a million.
These documents are gems, I’m going to spend some time on them I think!
By the way as I walk through the Coda gallery, I am noticing that I have seen documents created by you before!
It was also, at the time I posted my question, time to sleep here (France), and I will now study your suggestions and documents.
I’m looking to create a to-do list document to learn how to use Coda with a concrete example.
(and I’ve learned the word “rambling” now!)
(By “succinct” I meant not the page itself, but the instructions for each formula, which are very short.)

Again, thank you so much for such a precise and detailed answer.

1 Like

Louca, thanks a lot.
I will test this as well. Exciting. Thank you. It already helps me to understand how to sequence the instructions. I have several “Status” (5), I will be able to decline them thus, I will try that. Thank you very much Louca.

I’ll also plug a resource I made some time ago:

There’s an ultimate course that I’m building but that’s going to happen later.
Other than that, happy to unblock you in a short call that we can schedule sometime — DM me if interested.


I stumbled upon it yesterday, and have been browsing it just so! Thank you. I had already watched one of these videos a few days ago, on youtube. Thank you for the suggestion, I will try to move forward and progress, but I keep this in mind.

HI Gabriel

This is exactly why I started those two docs I shared. In the beginning I was quite confused by having to use dot-notation in tables, while none of the examples were in dot-notation.


1 Like

Depending on your actual doc there can be multiple ways to create a multi-actions buttons :blush:

Here’s a quick sample with 2 “cycle through” buttons :blush:
(One changing a status moving forward and the other, doing the opposite)

It’s different I think than what you’re actually trying do but it’s just to illustrate a possibility (as you’re speaking about having 5 statuses) :blush:

(I too am currently short on time at the moment so I can add explanations later, if needed :blush: )


I’m tearing my head off! :face_with_spiral_eyes:
In fact I expressed myself badly, what I want to do is - even more - simpler:
Click on the button “Action” → Status (column) → “Action”.
Click on the same button “Action” → Status → (return to)Blank.
(as a kind of “undo”, in fact)
my first step is:
ModifyRows(thisRow, TableName.Status, “Action”)
This (is the only thing that) works.

My second step “is”:
SwitchIf(thisRow, TableName.Status, “Action”, " ", " ")
and multiple (a lot, actually!) variations of this second part!

I tried placing everything (ModifyRows AND SwitchIf) in one common parenthesis, separated by a comma, then each of the two “orders” in their own parenthesis, once separated by a comma, once separated by a period, etc. etc. etc.)
but without success… Sometimes it even breaks the first step.

(I notice that what confuses me a lot is to know when to put “( )”, “=”, “.” or “,”!)

Are these instructions to use at least the right ones: ModifyRows+SwitchIf?

(Of course, i could easily make another column with a new button “Reset Status” and the issue would be solved…)

HI Gabriel,

The frustrating thing about Coda, is that when you eventually get the formula right, it looks so damn easy… Still gets me after 18 months. :wink:


The live page is below:



Gee, thanks Piet, so much, for unblocking me…!
Looks simple indeed, i can even understand without twisting my brain!
So I was totally on the wrong track trying to combine ModifyRows and SwitchIf.
I’ll study your document to assimilate the formulas… modestly! :sweat: :smiling_face:
Best regards

1 Like

Love it ! It’s so smart and elegant !

1 Like

But…use switch() (or in some cases SwitchIf() ) when you want to use more states of your button: you can make it do a sequence of things with a very simple formula.

Copy this sample to see and play with the formula for the button text and for the button action


HI Gabriel,

You were very close with the formulas you had, it was just that the ModifyRows() shoulw be inside the If() or SwitchIf(),

I still frequently go to my examples doc to get the syntax right.


1 Like

Oh, I just remembered I had an unlisted live stream that could help you — my yet another attempt at recording my fundamentals course some 1.5 years ago:

Here I’m talking about the whole anatomy of formulas.


Ha! That’s it… Thanks a lot.
Tomorrow I will attempt to reproduce it by memory.
Thank you so much.

Thank you Paul,
I just started watching the first 30 minutes, and will continue tomorrow.
So much value in this stream!