Modify Rows in Coda

Simple & more complex cases

Christiaan Huizer

--

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.

I hope this article was informative and helpful. Did it help you to solve a problem you unlike would have solved other ways? What about a donation?

My name is Christiaan, and I regularly blog about Coda. While this article is free, my professional services (including consultations) are not, but I’m always happy to chat and explore potential solutions. You can find my free contributions in the Coda Community and on X. The Coda Community is a fantastic resource for free insights, especially when you share a sample doc.

Coda expert Christiaan on: ”Modify Rows in Coda”

--

--

Christiaan Huizer
Christiaan Huizer

Written by Christiaan Huizer

I write about how to Coda . You find blogs for beginners and experienced makers. I publish about 1 / week. Welcome!

No responses yet