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

**URL:** <https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466>\
**Category:** Get Help\
**Created:** [January 29, 2022, 11:34pm UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466 "2022-01-29T23:34:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![masp](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@masp](https://community.fibery.io/u/masp)\
**Post date:** [January 29, 2022, 11:34pm UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466/1 "2022-01-29T23:34:20Z")

</div>

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 [fibery.io](http://fibery.io) 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!

---

<div class="post-metadata">

**Author:** ![masp](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@masp](https://community.fibery.io/u/masp)\
**Post date:** [January 29, 2022, 11:41pm UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466/2 "2022-01-29T23:41:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![masp](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@masp](https://community.fibery.io/u/masp)\
**Post date:** [January 29, 2022, 11:48pm UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466/3 "2022-01-29T23:48:26Z")

</div>

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!)

---

<div class="post-metadata">

**Author:** ![masp](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@masp](https://community.fibery.io/u/masp)\
**Post date:** [January 30, 2022, 1:21am UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466/4 "2022-01-30T01:21:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [January 30, 2022, 8:50am UTC](https://community.fibery.io/t/trying-to-create-self-referential-formula-and-or-tree-view-of-self-related-dataset/2466/5 "2022-01-30T08:50:46Z")

</div>

> [@\[DONE\] Many-to-many relationships should be usable for levels in lists](https://community.fibery.io/t/many-to-many-relationships-should-be-usable-for-levels-in-lists/1624):
>
> I have [Product] \*------\* [Feature]. (Features belong to products, but some features span multiple products; e.g. “2FA” is a feature of both the backend CMS and of the mobile app). There is also a [Product] ----\* [Bug]. (A product can have bugs.) When I create a list, I can add Bug as a second level, but not Feature. Why not?
