Tree Node Loop - Sequential ========================================= -- loop through every element in the tree -- This is a sequential list declare v_node FTREE.node; v_tree_item item; v_state varchar2(30); v_value varchar2(100); v_label varchar2(100); BEGIN v_tree_item := Find_Item('TREE_BLK.TREE_CTL'); -- Find the tree item if id_null(v_tree_item) then message ('ERROR : Could not find tree item'); message (' '); end if; v_node := FTREE.Find_Tree_Node(v_tree_item, ''); -- Find the root node of the tree. WHILE NOT FTREE.id_null (v_node) LOOP -- loop through all nodes in the tree -- at this point a tree node has been found v_value := substr (FTREE.Get_Tree_Node_Property(v_tree_item, v_node, FTREE.NODE_VALUE) ,1,100); v_label := substr (FTREE.Get_Tree_Node_Property(v_tree_item, v_node, FTREE.NODE_LABEL) ,1,100); -- process the node if :CONTROL_BLK.DUMPX is not null then :CONTROL_BLK.DUMPX := :CONTROL_BLK.DUMPX || chr(10); end if; :CONTROL_BLK.DUMPX := :CONTROL_BLK.DUMPX || v_value || ' - ' || v_label; -- get next tree node v_node := FTREE.Find_Tree_Node( item_id => v_tree_item, search_string => '', search_type => FTREE.FIND_NEXT, -- FIND_NEXT | FIND_NEXT_CHILD search_by => FTREE.NODE_LABEL, -- FTREE.NODE_LABEL | FTREE.NODE_VALUE search_root => '', -- root start point start_point => v_node -- start element ); END LOOP; END; Tree Node Loop - Hierarchical ========================================= PROCEDURE process_tree_child_nodes ( p_tree_item_id item ,p_tree_parent_node FTREE.NODE := FTREE.ROOT_NODE ,p_level number := 1 -- Internal to this procedure. level number of the parent node ,p_parent_node_descr varchar2 := '' -- Internal to this procedure. description of the parent tree node ) is -- process all nodes in the tree using hierarchical order v_node FTREE.node; v_state varchar2(30); v_value varchar2(300); v_label varchar2(300); v_child_counter number := 0; k_routine CONSTANT varchar2(30) := 'process_child_nodes'; PROCEDURE logx (s in varchar2) is begin cls_system_log.insert_log ( NAME_IN('SYSTEM.CURRENT_FORM') || ' : TEST : ' || substr (s,1,100) ,'TRACE' ); end; BEGIN v_node := FTREE.Find_Tree_Node( item_id => p_tree_item_id, search_string => '', search_type => FTREE.FIND_NEXT_CHILD, -- FIND_NEXT | FIND_NEXT_CHILD Searches only the children of the search_root no search_by => FTREE.NODE_LABEL, -- FTREE.NODE_LABEL | FTREE.NODE_VALUE search_root => p_tree_parent_node, -- root start point start_point => p_tree_parent_node -- get first element ); WHILE NOT FTREE.id_null (v_node) LOOP -- loop through all nodes in the tree v_child_counter := v_child_counter + 1; -- ================================================== -- at this point a tree node has been found -- ================================================== -- get information about the node v_value := substr (FTREE.Get_Tree_Node_Property(p_tree_item_id, v_node, FTREE.NODE_VALUE) ,1,300); v_label := substr (FTREE.Get_Tree_Node_Property(p_tree_item_id, v_node, FTREE.NODE_LABEL) ,1,300); v_state := FTREE.Find_Tree_Node(p_tree_item_id, v_node); -- FTREE.COLLAPSED_NODE | FTREE.EXPANDED_NODE -- logx ('Tree :' || ' Level=' || p_level || ' Child#' || v_child_counter || ') ' || ' NodeDescr=' || ltrim (p_parent_node_descr || '.','.') || v_child_counter || rpad (' ', (p_level-1)*3, ' ') -- indentation to represent tree level || v_value || ' - ' || v_label ); -- ================================================== -- process all child nodes of this node process_tree_child_nodes ( p_tree_item_id => p_tree_item_id ,p_tree_parent_node => v_node ,p_level => p_level + 1 ,p_parent_node_descr => p_parent_node_descr || '.'||v_child_counter ); -- get next tree node v_node := FTREE.Find_Tree_Node( item_id => p_tree_item_id, search_string => '', search_type => FTREE.FIND_NEXT_CHILD, -- FIND_NEXT | FIND_NEXT_CHILD Searches only the children of the search_root no search_by => FTREE.NODE_LABEL, -- FTREE.NODE_LABEL | FTREE.NODE_VALUE search_root => p_tree_parent_node, -- root start point start_point => v_node -- start element ); END LOOP; EXCEPTION WHEN OTHERS THEN logx (k_routine || ' error : '||substr (sqlerrm,1,100)); END process_tree_child_nodes;