[Offer] Subtasks in a task

P.S. Just to make things easier to understand:

  • Since “sub-topics” and “topics” are the same thing — you put them on the same table. One “kind of thing” — one table. If you had two conceptually different things (e.g. projects and tasks, having two distinct sets of properties) then you’d go with separate tables.

  • The conventional way to build a hierarchy for entries of the same kind of thing — is to specify a parent entry for each entry. The entry that has no parent entry is the one that sits on the top. In Coda this can be done by adding a Lookup column of the same table.

  • On its own, that Parent column doesn’t mean anything. It’s what you do with it then that matters. E.g., you can recursively construct the path of each item:

If(
  thisRow.[Parent item].IsBlank(),
  thisRow,
  ListCombine(thisRow.[Parent item]._Path, thisRow)
)

You can query immediate children (i.e. for each row pull rows that have this row as a parent):

thisTable.Filter(CurrentValue.[Parent item] = thisRow)

Or all descendants, based on path:

thisTable.Filter(CurrentValue != thisRow AND CurrentValue.Path.Contains(thisRow))

In my case with that tree map demo, what I’m doing is using that parent-child relation to ultimately calculate the X,Y coordinates of the nodes and lines to draw :slight_smile:

When displayed in Layout view, you can render children or descendants as a subtable. You can add a button to drill down to the sub-task via row URL (although it seems like it may have stopped working recently):

P.S. Actually in Coda this can be done the other way around as well. Instead of specifying a parent, you can add a multi-select Lookup column where you’d specify children. But I guess it’s a matter of convention to do this the other way around. First, it’s sorta traditional, since databases usually can only store one reference in a property (i.e. one parent). Second, it’s harder to mess up this way, ending up with a task belonging to multiple parents (unless that’s what you need). Third, adding tasks doesn’t require going back to the parent entry and updating the list of children there — you select the parent as you populate the child row, and so it’s harder to forget to assign it.