Photo by Ante Hamersmit on Unsplash

How to Coda a Divorce Planning IV

How to plan the distribution of the children?

Christiaan Huizer
5 min readSep 6, 2022

--

In my third blog on divorce planning I mentioned how my table supports the distribution of the children. I used the screenshot you see below. To make ti work, there is a button to duplicate the source row. The Group Index remains the same (1.1 in the screenshot below).

As such we have from a technical point of view a solution to create additional time slots per day per child. This logic can be applied for every day. I observed that adding rows results in more complexity: you lack overview and mistakes are easily made.

Can we keep it simple?

Making a doc as powerful as an app implies that the user is served in such a way that (s)he proceeds well without wondering am I right. This is easier said than done. What I did to support the user journey:

  • I added a column with consecutive numbers and gave the odd numbers a grey color, while the even rows remain white. This helps to see you are still in the same day. When you duplicate the row, this number is copied as well (the number is not formula based, but the output of a button action).
  • You have an orange cell when the parents differ and there is not a time slot yet.
  • The summary of the action is with bullet points in the first column. This permits the user to check if the outcome is the desired one. There are multiple bullets when multiple actions.
  • Users can make mistakes. They can for example ‘forget’ to mention a child. In that case you see purple.
signal colors

To avoid mistakes

Parents who complicate the contact arrangement need the supervision of an experienced divorce planner to avoid mistakes. There is so much variation possible (the complexity) that one easily gets confused and looses oversight. The divorce planners I spoke to, all insisted on simplicity. But again, sometimes it is simply complicated and then you need to rely on your solution to support the people who already have a hard time.

The summary with bullet points

The code behind the bullet points is complex, too complex to explain in this blog. I make use of 4 helper columns and only one of them I’ll explain here since you might like the logic that I apply. It is about the names of the children.

I start with a screenshot to show the first part of the code and also how the outcome is printed in every cell.

We have 4 scenarios and for each we have to create a rule:

  • One kid
  • Two kids
  • More than two
  • All kids

Below the solution:

Splitting names

The one child logic is easy. In case we count only one, we take the first name. Two children is also good to do. We apply the Split(‘,“).Join(“ and”) logic to get something as Louis and Eloïse

The third option covers all kids in case you have more than 3. to keep it short we say ‘all children’. The most interesting part is the fall back option. This one you need when you have in total 4 children and 3 go to the father, while one remains at the mother. This results in something as: “Noel, Louis and Emma”.

Sequence(1,thisRow.Kids.Count()-1).ForEach(thisRow.Kids.FirstName.Nth(CurrentValue).Join(", ")).WithName(start,Format("{1} and {2}",start.List(),thisRow.Kids.FirstName.Last())))

We join the all the names, but not the last one and we got here via the minus one in the Sequence() the outcome we renamed as ‘Start’ and this one we use in our Format, but not before we added List() to it to make it work. Obviously we took the last value and glued it together with the start list. This formula is good to read and works fine.

In my next blog I’ll handle the buttons to generate DB Planning, but not before I applied the distribution logic also to the table that is about the holidays. In our previous set — up we had a simple but not good enough solution to deal with the days the children stay with their parents. Looking back, the initial solution had as starting point not the procedure but the daily experience of children going to school. This we corrected with the mentioned solution. Even if you Coda all day, you sometimes have to go back and correct your assumptions and thus functions. It happens to the best.

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.

Christiaan — Coda Expert — on: “How to Coda a Divorce Planning IV”

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.

--

--

Christiaan Huizer

I write about Coda.io. Mainly on Coda AI and interesting HR planning challenges. You find blogs for beginners and experienced makers.