Forum Academy Marketplace Showcase Pricing Features

How to create list from self-referencing data type (like parent-child relationships in genealogy)

Hi there,

I would like to create lists of database objects that have references to other objects of the same type. Is there a way to create such lists dynamically and add them to repeating groups as data source.

Let me give you an example: genealogy. I do have a User data type. Each user has the fields parents (list of User) and children (list of User). You can see an example in the screenshot.

Each user can have multiple parents and children. I would like to create a list of Users that starts with one parent (or maybe at given level of a tree). See the screenshot as example. I would like to render a list that starts at level zero (Jane and John are part of the list) or at the User Jane (only Jane is part of the list). The list should include all children and their children and their children and so on…

So, my questions would be:

  1. Is it possible to create such a dynamic list (and how)? Basically, I want to iterate recursively over a tree.

  2. Is it possible to render some kind of repeating group that looks like the painted screenshot?

Thanks very much,

I saw a nice plugin that may be of some use for your project.

Database wise, as you say, each person has a parent and a child list, and from that the family tree will propagate with the correct repeating groups.

1 Like

Have you found a solution Marco? I’m trying to develop the same thing on Thimo’s OrgChart Plugin, but it needs some slight tweaking for my use case. Would definately recommend for your case though.

Let me know what you figure out