Photo by Markus Spiske on Unsplash

How to Coda with JSON — Canvas

Counting the checked boxes

Step 00 — turn the canvas column into a JSON Object

This is something to you have to know, not something Coda will teach you:

turning column value into a JSON object

Step 01 — find the list of check boxes

The next step is to find the checkboxes and for this we use the double dot in combination with the dollar symbol and we reference the term we found in the code snippet. This is JSON syntax you have to get used to in order to work with it.

finding the checkboxes
thisRow.Notes._Merge().ToText().ParseJSON("$..style").ListCombine().Filter(CurrentValue.Contains("CheckboxList")).Count()

Step 02 — find the checked boxes

We repeat more or less the previous step, but using a different term, because we look for checked boxes.

finding the true items

Step 03 — count these items

this is the easiest part and a classical CFL approach and differs from the JSON and JS logic. We use Count() to count and not Length to get the count in a list.

counting the items

Step 04 — compare the outcome

comparing the counted outcomes is done with a simple function that outputs true or false

comparing the counted items

All In One

What if you want to do all of this in one function? That is a bit different but not complicated with the previous developed knowledge at our fingertips. We integrated — a few days after I first wrote the blog — the insight that we have to take care of additional elements as well and this results in what you see below.

all in one taking into account other style elements as well

What about sub lists?

That is a different trick. Although Coda presents new functions (Separate as JSON) to deal with JSON in a table, what you first need is understanding the syntax and for this we use a website.

understanding the syntax
additional levels
line levels in actions
Christiaan — Coda Expert — on: “How to Coda with JSON — Canvas”

--

--

I use Coda mainly for (HR) planning & (budget) calculations. Follow me to learn how to Coda with numbers. I blog at least once per week.

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

I use Coda mainly for (HR) planning & (budget) calculations. Follow me to learn how to Coda with numbers. I blog at least once per week.