Hi,

I have 2 tables as follows :

1) groups -- Domains values
2) nes -- Children in the Domain

I wrote a procedure as follows but it is
populating the domains at the same LEVEL.
Could anyone assist me with this.


PROCEDURE create_tree
IS

htree ITEM; -- TREE item
v_new_root_node FTREE.NODE;-- ROOT NODE
top_node FTREE.NODE;-- NOT USED
new_node FTREE.NODE;-- New Node in TREE
child_node FTREE.NODE;-- Child Nodes
domain_value VARCHAR2(30);
child_value VARCHAR2(30);
lev_num INTEGER; -- Level Number.

-- Cursor for the DOMAINS

CURSOR c1 is
select id,fdn,level from groups
connect by prior
fdn=parent_fdn start with fdn='/';

-- Cursor for the children in the Domain

CURSOR c2(param varchar2)
IS
select clli from nes where parent_fdn=param
order by clli;

BEGIN
htree := Find_Item('BLOCK5.TREE4');

-- Create a ROOT NODE for the tree.

v_new_root_node := FTREE.ADD_TREE_NODE
(
htree,
FTREE.ROOT_NODE,
FTREE.PARENT_OFFSET,
FTREE.LAST_CHILD,
FTREE.EXPANDED_NODE,
'ROOT',
NULL,
NULL
);

-- Loop and Add Domains to the Root Node

FOR grp_rec in c1 LOOP

lev_num := grp_rec.level;

IF lev_num > 1 THEN

domain_value := grp_rec.id;
new_node := FTREE.ADD_TREE_NODE
(
htree,
v_new_root_node,
FTREE.PARENT_OFFSET,
FTREE.LAST_CHILD,
FTREE.EXPANDED_NODE,
domain_value,
NULL,
'level1'
);
END IF;
-- Loop and Add the children in the domain to
-- the domain

-- Note : The children are not added to
-- the parent domains Why??

FOR nes_rec in c2(domain_value) LOOP

child_value := nes_rec. clli;
child_node := FTREE.ADD_TREE_NODE
(
htree,
new_node,
FTREE.PARENT_OFFSET,
FTREE.LAST_CHILD,
FTREE.LEAF_NODE,
child_value,
NULL,
'level12'
);
END LOOP;

END LOOP;

END create_tree;


The children in the domain are also not being
added to their parent domains. Why ????

Also How do I get the depth to work ??.
All the nodes are populating at the same level.