Creating a smart list in Coda
Using info living in table to present data on the canvas
In my document showing how clients can follow-up on my work and on my compensation there is this table.
This blog shows you a rather easy way to distract the data living in the column ‘hoursIncluded’ and putting it’s data on the canvas. You can take any list with a sequential type and it will work. You will get something like below:
The direct and easiest way to get this list is what you see below, but as you may imagine, this won’t do the job because we cannot identify each number individually in this list.
To have access to the individual numbers in the list, we need a virtual index we create using the combination of
Our next and third step is to create a variation on this list that deals with the next one, literally in the sense that we need to add ‘one’ to the existing number. Since this part is about the left side, we need as many numbers as on the right side, but the last number right plus one should not be included, instead — as we show in step 4 — we need a one to start with. The solution is to have a virtual index that stops one before the end, that is why you see the — 1 in the
Sequence(). To each of the numbers in the list we add one, here comes the
Sum() into play, although we could have used + 1 as well.
We are almost there, in our step number 4 we need to add a one to this list. And it is as easy as I write it, have a look. We take the list we generate and we add number one via
I would not have written this blog it it was only a matter of bringing two lists together in a simple manner.
Indeed for our step 5 we need to understand a bit better how we can manipulate lists in such a way that the outcome is what we have in mind. First we have to evaluate each item in the list. Each item is the list is the outcome of a
ForEach() evaluation. Manipulating each item means that we use another
ForEach() to run over the outcomes. This outcome is what you partly see below. We use my favorite
Format() function and within we have two functions we reference and as said before, each function is evaluated via the
ForEach() outside the
Indeed you see the outcome partly. In the preview the first line is not present, it is the 1–1. I don’t know why Coda skips this one in the preview.
Last but not least we can format the the numbers in such a way that they always have 3 digits. The function
LeftPad() does the job. Below the code that created the list.
In sum we have 6 steps to make to get to the result. The insights from steps 4 and the last step are crucial. It takes a bit of time before you can create such a logic, but don’t worry it will come.
Via this doc you can follow the steps in an easy way:
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
My name is Christiaan and I support SMB with calculations (budgets and planning) and I prefer using Coda to get the job done.
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.
If you enjoyed this read and would like to get more Coda related content, please consider a Medium membership. It is it only $5 a month, and you’ll have access to every article ever published on Medium. If you sign up using my referral link, I’ll earn a small commission.