If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > How to get depth (i,e level ) in Add_Tree_Node function in Oracle forms 6i

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: bangalore
Posts: 12
How to get depth (i,e level ) in Add_Tree_Node function in Oracle forms 6i

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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On