TDBTree Code Parent - Master Detail - sample code
Posted: Mon Oct 03, 2011 2:48 pm
I have implemented a TDBTree using one dataset with a code field and a parent field pointing to it.
Similar to TDBTree Wizard sample code (Database Tree Wizard).
Now I would like to add one additional level to the end of the tree based upon a master - detail relationship.
Could you please provide some sample code on how to add this additional level.
Do I have to use Layout?
Sample code:
DbTree1.DataSet := dm_main.qry_tree_structure; // some table
dm_main.qry_tree_structure.Open;
DbTree1.Layout[0].codefield := 'CODE_ID';
DbTree1.Layout[0].Parentfield := 'PARENT_ID';
DbTree1.Layout[0].fields := 'NAME';
DbTree1.Refresh;
The number of levels in the tree is not fixed, for some data you see a total of 4 levels, for some data a total of 5 levels, for some data a total of 6 levels.
Table1.CODE_ID is linked using a master detail relationship to Table2. I would like to display Table2.name one level below the tree end.
Thank you in advance for your reaction.
Similar to TDBTree Wizard sample code (Database Tree Wizard).
Now I would like to add one additional level to the end of the tree based upon a master - detail relationship.
Could you please provide some sample code on how to add this additional level.
Do I have to use Layout?
Sample code:
DbTree1.DataSet := dm_main.qry_tree_structure; // some table
dm_main.qry_tree_structure.Open;
DbTree1.Layout[0].codefield := 'CODE_ID';
DbTree1.Layout[0].Parentfield := 'PARENT_ID';
DbTree1.Layout[0].fields := 'NAME';
DbTree1.Refresh;
The number of levels in the tree is not fixed, for some data you see a total of 4 levels, for some data a total of 5 levels, for some data a total of 6 levels.
Table1.CODE_ID is linked using a master detail relationship to Table2. I would like to display Table2.name one level below the tree end.
Thank you in advance for your reaction.