Photo by Jordan Whitfield on Unsplash

Modify Rows in Coda

Simple & more complex cases

Christiaan Huizer
4 min readFeb 10, 2023

--

One the core functionalities of a Coda button is to modify a value in a column. The label Modify Rows is a bit misleading since you can also modify a complete list — all items living in a column, see example 2.

A button prints a value in a cell. With printing we mean that the value shown in the cell can be the result of a function, but has — once printed — no longer a link with the function that generated the outcome. This implies that you can easily alter (manually or via a button or automation) the generated value. Tables filled out with only text values without formulas calculating them, run faster. This is one of the aspects that makes buttons interesting. Other advantages are:

  • check changes
  • update values

Example 01 — Modify this row

We start with an easy example. We modify a row based on a value living in an other row. The code below states that we use the value living in cb_src1 and that we show this value in cb_trgt1. Since this is a checkbox it is either true or false (for details check this blog) we see the box checked or unchecked in the target check box.

basic manipulation

Example 02 — Clear list and set value

The second example clears first all items in the list cb_trgt2 and next does what we showed in the first example. We need two modify ‘row’ functions. The first modifies all items in the list and this possible because we reference ‘thisTable’, while in the second function we have the standard modifyRows. We can only combine both functions using the RunActions(), the function that enables multiple actions.

clear list and modify list

Example 03 — uncheck Or check

This is a rather simple manipulation and highly efficient in case you need it. By applying the function Not() you alter the given state into its opposite.

get the oppossite state

Example 04 — Stock

The last example of this blog is related to keeping track of changing values which partly live already in the column (the list) we manipulate. This is a special since we can calculate with a value living in the target list. In the code below we have two resulst. The first one outputs a list of items, while the second takes the sum of these items.

items in stock

Conclusion

Most of what you need in Coda is possible with these examples. It is very well possible to print highly complex outcomes, but that does not change the Modify logic fundamentally. The above examples you can test in the sample doc.

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

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.

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.

Coda expert Christiaan on: ”Modify Rows in Coda”

--

--

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!