AnsweredAssumed Answered

hierarchical objects with 1:n related subdata - how to group along object tree?

Question asked by nounours777 on Nov 21, 2018
Latest reply on Nov 22, 2018 by nounours777



I don't know how to correctly name my problem, therefore searching for a solution was pointless ...


I have a bunch of objects (risks) which can be hierarchical. They are stored in a table "Risks", with an ID and a ParentID. I use this to make the risk object to be a hierarchical tree.




R1 - ID=R1, ParentID = empty

R1a - ID=R1a, ParentID = R1

R1b - ID=R1b, ParentID = R1.


On the relation graph, I have now three instances of the RiskTable: Risk, ChildRisk, ParentRisk which are related to each other, in way that I can show on each Risk it's parent (if any), and it's childs.


On R1, I show in the child-Portal all Childrisks, e.g. R1a, R1b.


I think this is called Self-Joined?


Now, I attach to each risk subdata "Measures" with a 1:n relation, measures are in the table "measures", having ID and RiskID. So every risk can have 0, 1 or more risks attached.


With the risk-measure relation, it is easy to show the measures directly attached to the risk in a portal.


Now, what I want to do: I want to show all measures, which are directly attached to the risk OR which are attached to a child risk OR which are attached to a grandchild risk ... (...possibly specifying the number of levels shown. Or possibly including the parent ... - but this will be simple once the inital problem solved).

So basically, I want to group all subdata along my object tree ...


I have no clue how to achieve this. Even not how to call this problem exactly. I'm convinced this is a standard problem, which has a name and a solution, but ...


Thanks for help!