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.
TDBTree Code Parent - Master Detail - sample code
-
- Newbie
- Posts: 3
- Joined: Mon May 05, 2003 4:00 am
-
- Newbie
- Posts: 3
- Joined: Mon May 05, 2003 4:00 am
Re: TDBTree Code Parent - Master Detail - sample code
Good afternoon,
Using Parent / Code relationship Delphi code we solved this issue by changing the SQL - query using UNION ALL.
select ...
from table1
UNION ALL
select ...
from table1, table2
where ... ( join )
Best regards,
Erik
Using Parent / Code relationship Delphi code we solved this issue by changing the SQL - query using UNION ALL.
select ...
from table1
UNION ALL
select ...
from table1, table2
where ... ( join )
Best regards,
Erik
Re: TDBTree Code Parent - Master Detail - sample code
Hello Erik,
I was going to ask you for more details to understand better your needs, but I'm glad to hear you found how to achieve it.
I was going to ask you for more details to understand better your needs, but I'm glad to hear you found how to achieve it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |