2 Replies Latest reply: Mar 21, 2013 12:32 PM by InoL RSS

    Hierarchical Tree cannot populate

    998255
      Hi all senior and expert,

      Im new in oracle forms 10g and now im trying to develop system using hierarchical tree,but when im run for testing my tree cannot populate..Please help me...

      My program Units:


      PROCEDURE run_tree IS
      BEGIN

      DECLARE
      htree ITEM;
      v_ignore NUMBER;
      rg_emps RECORDGROUP;
      a varchar2(300):=' ';
      startmenu varchar2(100):=' ';
      node FTREE.NODE;
      state varchar2(100):=' ';

      cursor aa is
      select distinct menu_name from menu_master_user
      where nvl(FORM_NAME,' ') = ' '
      and user_key = :global.user_key
      and nvl(menu_name,' ') <> ' '
      and seq <> 0;

      BEGIN
      -- Find the tree itself.
      htree := Find_Item('tree4');

      -- Check for the existence of the record group.
      rg_emps := Find_Group('menu');
      IF NOT Id_Null(rg_emps) THEN
      DELETE_GROUP(rg_emps);
      END IF;

      BEGIN
      select distinct menu_name into startmenu from menu_master_user
      where user_key = :global.user_key
      and seq=0;

      EXCEPTION
           WHEN NO_DATA_FOUND THEN
           MESSAGE ('This user has no accessible item setup in the user access module,Please report to CICT for accessible...');
           MESSAGE ('This user has no accessible item setup in the user access module,Please report to CICT for accessible...');
           raise form_trigger_failure;
      end ;

      rg_emps := Create_Group_From_Query('menu',
      'select 1,level,menu_name,:global.drive||icon_file,form_name
      from menu_master_user where user_key='''||:global.user_key||
      ''' connect by prior menu_name=root_menu and user_key='''||:global.user_key||
      ''' and acc=''Y''
      start with menu_name='''||startmenu||''' and user_key='''||:global.user_key||
      ''' order by seq');
      a:='select 1,level,menu_name,:global.drive||icon_file,form_name
      from menu_master_user where user_key='''||:global.user_key||
      ''' connect by prior menu_name=root_menu and user_key='''||:global.user_key||
      ''' and acc=''Y'' start with menu_name='''||startmenu||''' and user_key='''||:global.user_key||
      ''' order by seq';

      -- Populate the record group with data.
      v_ignore := Populate_Group(rg_emps);

      -- Transfer the data from the record group to the hierarchical
      -- tree and cause it to display.
      Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_emps);

      -- Find the tree itself.
      htree := Find_Item('tree4');

      -- Find the root node of the tree.
      --node  := Ftree.Find_Tree_Node(htree,'Setup');
      -- Loop through all nodes and expand each one if it is collapsed.
      for aaa in aa loop
           node := Ftree.Find_Tree_Node(htree,aaa.menu_name);
      IF NOT Ftree.ID_NULL(node) then
      state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
      IF state = Ftree.EXPANDED_NODE THEN
      Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.COLLAPSED_NODE);
      END IF;
      end if;
      END LOOP;

      END;
      END;

      Any solutions or my code is wrong?

      Edited by: 995252 on Mar 21, 2013 12:17 AM