Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Tree structure with more than one table
Tree structure with more than one table [message #7731] Tue, 31 May 2022 03:57 Go to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Have you ever created a flexible tree structure with more than one table?

I ask because I would like to map a structure with organizations, clubs, seasons, teams and team members. However, the data of the respective tables are stored in different tables. The tables can be linked to each other using the primary keys.

Is there a way to achieve this in _cm_getNodeData()?
Re: Tree structure with more than one table [message #7732 is a reply to message #7731] Wed, 01 June 2022 05:01 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
What do you mean by "more than one table"? My article at A Flexible Tree Structure identifies 3 tables - TREE-TYPE, TREE-LEVEL and TREE-NODE. Why is this not enough for your needs?

Re: Tree structure with more than one table [message #7733 is a reply to message #7732] Wed, 01 June 2022 05:40 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Yes, I know and it works fine. But what I mean is, if it is possible to create a structure with more than one 'node' table? I attached a screen shot where you can see the organisation hierarchy. These occurences are all stored in one table. Now I have additional tables for the teams and for the team members. And my question is, if these two additional tables can be shown in the tree structure?
Re: Tree structure with more than one table [message #7734 is a reply to message #7733] Thu, 02 June 2022 05:02 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
What is the structure that you are trying to represent?

Have you thought about adding another TREE-TYPE as this can give you another set of nodes. It is possible for a LEAF entity to be attached to nodes from multiple TREE-TYPEs.


[Updated on: Thu, 02 June 2022 05:03]

Report message to a moderator

Re: Tree structure with more than one table [message #7736 is a reply to message #7734] Fri, 03 June 2022 04:17 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
As far as I understand correctly, the tree structure is build with records from TREE-NODE. Can I attach records from a different table instead of only records from TREE-NODE? Otherwise I had to insert the already existing occurrences from my tables in TREE-NODE to get them shown in the tree structure.

But I think that if this should work, you have to identify the table first and then the node of this table, to attach this node in the tree structure. But in your flexible tree structure isn't a 'table' column. Question: would this work? and would that be feasible? Or am I wrong and do not understand right how to solve such a problem?
Re: Tree structure with more than one table [message #7738 is a reply to message #7736] Fri, 03 June 2022 04:49 Go to previous message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
The tree structure contains only three tables - TREE-TYPE, TREE-LEVEL and TREE-NODE with which you can construct many types of different tree structures. A LEAF is a table in your application database which can contain a foreign key into one of the TREE-NODE entries. When I say "one" I mean one within a particular TREE-TYPE, so it is possible for a LEAF to contain foreign keys into TREE-NODEs with different values for tree_type_id.

If you want you could use your LEAF table as just a stepping stone and have another table acting as a CHILD-LEAF, with multiple rows if necessary, and then in a third application table you could have a foreign key into CHILD-LEAF instead of LEAF.

You still have not provided me with a pictorial example of what structure you are trying to achieve, so I cannot provide a definitive solution.


Previous Topic: Output 3 - _cm_output_multi()
Next Topic: _cm_outputMulti() - "parent-child-grandchild"
Goto Forum:
  


Current Time: Thu Nov 21 10:28:44 EST 2024

Total time taken to generate the page: 0.01325 seconds