Trying to create self-referential formula and/or tree view of self-related Dataset

Hi! I must say that fibery is awesomely powerful! I’m now trying to do something that I don’t THINK is possible at first glance, but I thought I should check: I want to define a Dataset that I can use to create a hierarchical taxonomy (of task tags): the Dataset would be “Tag” and it’ll include a “Parent” field which is a relation to “Tag”: so ie. I can define a linked list of Tags, in the form of a dynamically growing tree: any node of the tree, at any depth, will still be a Tag. So it’s ONE Database, but representing a tree with arbitrarily many branches, arbitrarily deep. That part is fine. But now I’d like to visualize the Tag tree: I haven’t got very far, but my first thought was to create a formula field “Level” = “Parent.Level + 1”. However, I can’t create that because it’s self-referential: there’s no existing “Level” field to refer to when I try to define the field. So I’m wondering if any experts have thought about something similar, and can offer any advice that would get some way towards my goal: eg. could I define a self-referential formula through some indirect mechanism? Or could I generate a tree-structured view without it? Thanks in advance!

1 Like

Update: cool: I figured it out! Solution:

  1. Created “Level” formula, with arbitrary (non self-referential) formula inside.
  2. Updated “Level” formula to read: If(IsEmpty(Parent),1,Parent.Level + 1)

This works!! Now I need to figure out if/how I can use this to create a tree visualization. Any help on that front still appreciated!

1 Like

OK so I’m just going to be replying to myself all morning because I’m on an awesome voyage of fibery self-discovery: it turns out that my tree view is TRIVIAL to create: apparently due to the presence of the self-relation (“Parent”), when I create a list and define the levels and select the level “Tag”, I see a little circular icon next to “Tag”, and when I click it I HAVE a hierarchical tree structure automatically! I’m frankly stunned that this is so easy and just works as it does! My hat is very firmly doffed to fibery’s architects!!

(Note: of course it turns out I didn’t need to create my nifty self-referential “Level” formula to achieve this, although I’m glad I figure that out because it’s cool in its own right!)

Ok one more reply to myself: I tried to stretch fibery a little more: I modified the “Parent” relation so that it’s many:many (each child can have multiple parents). I was hoping that this would result in a tag that has multiple parents showing up in both parents’ hierarchy, but unfortunately it results in such a tag showing up at the top level instead. I guess maybe I’ve reached the limit of what fibery’s designers could anticipate on this front?! Is it going to be possible to accommodate this (many:many) variant in some way?

1 Like