Look Up like a Pro in Coda — Part II
Filtering on CurrentValue and relate it to other columns
In the blog below I showed how you can use the filter options in a lookup to get results that fit your needs.
The example that comes to mind often is selecting items from a list and each next individual can — as a result of this filter — no longer select an item that is already selected.
While setting up tables for a divorce planner — indeed in The Netherlands you can decide together to organise your divorce in an orderly manner without lawyers fighting over bits and pieces — I had to make sure that related data was kept together.
We call the people who are about to divorce ‘the couple’. A couple is made up of two people, we call them partner 01 and Partner 02, a partner can be male or female. This set up implies we have a base table with people and finally it i is the divorce planner who defines a couple in Coda.
The next step is to turn people into a couple, we do that as you can see below:
This logic only shows not yet selected people as option and with not selected I mean not yet as partner one nor as partner two. This makes it easy for the planner, he has the right names in front of him. Proceeding in this manner we reduce mistakes.
A variation on this logic is needed to link partner01 and partner 02 to the right couple once the couple is defined. In our case we have a property that has to be divided, the house the couple lived in together:
We cannot apply the previous defined logic to exclude already selected items because one couple can have more than one property. Instead we open up this table DB Addresses in the row of the couples.
It looks like what you see below and we got there by adding a lookup of the table DB addresses to the table DB Couples. In the modal we keep the table view and the smart thing is that you can apply a filter to only have the properties of the couple you are working on.
From here we add a property to the table DB Address with a button. This adds a row and pre-fills it with the name of the couple and opens in a nice modal, see below.
The blue button brings you back home, thus on the page where you left. In the blue button I apply the logic you see below:
This way of working shows the great power of Coda, not only in terms of Formula Language, but also regarding ways you can add and show data.
When showing the above to Joostmineur he suggested to use
ObjectLink() instead of the hard coded URL and that is indeed the better choice. Bit by bit we developed together the logic you see below as return path. It is a bit of magic that you have one button that redirects you to an other model and there you find a button to return where you came from.
that links to
Once this data set is completed the next step is define what will be done with the property:
- one partner stays and the other leaves
- they sell the property to somebody else (a third party)
- they keep the property and for example share the rent revenues or use it to house their children.
In these scenarios the divorce planner at work should only be able to select the related Partner 01 or Partner 02 or both (option 2 & 3).
Filters are all about true. Once the ‘inside’ of a filter is true, you can ask for an outcome. In the above we relate to the selected couple to get the partner. Once we know the partner who takes over, we also knows who is leaving. We first exclude the one who took over and we include the both partners again. We work like this because the filter is agnostic and does not know which partner (01 or 02) is taking over.
Applying the filter options in the lookup makes it easier for the divorce planner at work to select the right partners. It will avoid mistakes of all sorts.
In the community I applied a variation on the above logic in a set up for a sales process. You only want to see related (sub) products and that is possible by applying the filter logic in the Look Up. These kind of applications I consider of great value for they provide a strong and faultless user experience.
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.