2 Replies Latest reply: Feb 9, 2014 9:17 PM by PratikG RSS

populating tree using user input

PratikG Newbie
Currently Being Moderated

I am entering my department id and populating a tree if suppose i enter the value 10 then the tree gets populated for 10 department id

but after i enter 20 department then the previous entry doesnot get cleared and it gets populated under the dept 10 id.

please help me with some solution.

output is like this

if i enter 10 then it gives output


               Jennifer Whalen

then after i enter 20 then i get


               Jennifer Whalen


                 X Y Z

                A B C



      CURSOR c_dept IS

            SELECT *

              FROM hr.departments

              where department_id = :tre.dept_id;      tre is my block and dept_id is text item underneath it


      CURSOR c_emp ( n_dept NUMBER ) IS

            SELECT *

              FROM hr.employees

             WHERE department_id = n_dept;

  v_item_name varchar2(100);

      n_level     NUMBER := 1;

      n_row       NUMBER := 1;

      rg_id       RecordGroup;

      node        Ftree.Node;

      htree ITEM;

  num_selected varchar2(1000);

  delet_node ftree.node;




      v_item_name := 'f_tree.htre';

        rg_id := find_group('tree_group');


         -- Make sure the RG doesn't already exist.

         IF (  not Id_NULL(rg_id) ) THEN


         end if;


      rg_id := Create_RG;



      FOR r_dept IN c_dept


            -- Add Parent Department_ID

            ADD_RG_ROW(rg_id, ftree.collapsed_node, n_row,n_level, r_dept.department_name, null,r_dept.department_id);    add_rg_row is my group to populate the record group

            n_row := n_row + 1;

            n_level := n_level + 1;


            --Add Child Employee Records


            FOR r_emp IN c_emp(r_dept.department_id) LOOP

                  ADD_RG_ROW(rg_id, ftree.collapsed_node,n_row, n_level,r_emp.first_name||' '||r_emp.last_name,NULL, r_emp.employee_id);

                  n_row := n_row + 1;

            END LOOP child;

            n_level := n_level - 1;

      END LOOP parent;

      ftree.Add_Tree_Data(v_item_name, ftree.ROOT_NODE,ftree.PARENT_OFFSET, ftree.LAST_CHILD,ftree.RECORD_GROUP, rg_id);




  • Correct Answers - 10 points
  • Helpful Answers - 5 points