Solved

trees

Posted on 2003-12-07
11
585 Views
Last Modified: 2013-12-11
Hi experts,
i have a table called tb_tree this table contians the folowing fields :
nod_id number,
nod_name varchar2
nod_father number

now i want to show the data inside this table using a tree in the forms how can i do this and i want if the nod_father is null then it gives it an icon defferent than the icon if the nod_father was not null when display the tree in the form.

another thing and if i ckicked on a nod it gives me a message with its name

thanx alot :)
loay
 
0
Comment
Question by:loay
  • 6
  • 4
11 Comments
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
All answers you can find in the on-line help - "Manipulating a hierarchical tree at runtime" topic. There are also examples there.
0
 

Author Comment

by:loay
Comment Utility
but how can i set defferent icons for the data i bring from the database this is the main problem i am facing
0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
/*  
** Built-in:  SET_TREE_NODE_PROPERTY
*/

-- This code could be used in a WHEN-TREE-NODE-SELECTED trigger to change the icon of the node clicked on.

DECLARE
   htree         ITEM;
   current_node  FTREE.NODE;
   find_node     FTREE.NODE;
BEGIN
   -- Find the tree itself.
   htree := Find_Item('tree_block.htree3');

   -- Change it icon of the clicked node.
   -- The icon file will be located using the
   -- UI60_ICON environment variable in client/server

   -- or in the virtual directory for web deployment.
   Ftree.Set_Tree_Node_Property(htree, :SYSTEM.TRIGGER_NODE, Ftree.NODE_ICON, 'Open');
END;
0
 

Author Comment

by:loay
Comment Utility
this is a trigger from oracle online help what i need not when i clicked in the node it changes its icon i need at the first time when the tree published the noods that dont have a father to be as reets with special icons and the childs appears with another icons thats it and thanx any way for help.
0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
This is part of working code, I can post whole procedure if you want it.

PROCEDURE PRACA_SO_STROMOM IS
  htree         ITEM:= Find_Item('PRISTUPOVA_SIET_STROM.STROM');
  rg_skup     RECORDGROUP;
  rg_selekt   Varchar2(500);
  find_node  Ftree.NODE;
  n_ignore    NUMBER;
BEGIN
 rg_skup := Find_Group('STROM');
 IF NOT Id_Null(rg_skup) THEN
  DELETE_GROUP(rg_skup);
 END IF;
-- this is without an icon
 rg_selekt:='select 1,level,nazov,NULL,id from uzl_bod start with uzl_bod_id is null connect by prior id=uzl_bod_id';
-- try use DECODE instead of NULL according your wishes

 rg_skup  := Create_Group_From_Query('STROM',rg_selekt);
 n_ignore := Populate_Group(rg_skup);
 n_ignore := Get_Group_Row_Count(rg_skup);

 IF n_ignore>0 THEN
-- the tree is populated
   Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_skup);

   FOR i IN 1 .. n_ignore LOOP
-- here you loop through the tree and if you want you can do some another settings

      find_node:=Ftree.Find_Tree_Node(.....);

   END LOOP;
 END IF;

END PRACA_SO_STROMOM;
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
If DECODE will not work you can use this:

PROCEDURE PRACA_SO_STROMOM IS
  htree         ITEM:= Find_Item('PRISTUPOVA_SIET_STROM.STROM');
  rg_skup     RECORDGROUP;
  rg_selekt   Varchar2(500);
  find_node  Ftree.NODE;
  n_ignore    NUMBER;
  gc_id       GroupColumn;
BEGIN
 rg_skup := Find_Group('STROM');
 IF NOT Id_Null(rg_skup) THEN
  DELETE_GROUP(rg_skup);
 END IF;
-- this is without an icon
 rg_selekt:='select 1,level,nazov,NULL,id from uzl_bod start with uzl_bod_id is null connect by prior id=uzl_bod_id';

 rg_skup  := Create_Group_From_Query('STROM',rg_selekt);
/* columns of RG are: STROM.ICRGGQ_0,STROM.LEVEL,STROM.NAZOV,STROM.NULL,STROM.ID */
 n_ignore := Populate_Group(rg_skup);
 n_ignore := Get_Group_Row_Count(rg_skup);

 IF n_ignore>0 THEN

-- to the 4-th column - for icons  - you can put desired icons

   gc_id := Find_Column( 'STROM.NULL' );
   IF NOT Id_Null(gc_id) THEN
     FOR i IN 1 .. n_ignore LOOP
-- some conditions for icons - here is only Open icon without conditions
            Set_Group_Char_Cell(gc_id,i,'Open');
     END LOOP;
   END IF;

   Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_skup);

  END LOOP;
 END IF;

END PRACA_SO_STROMOM;
0
 

Author Comment

by:loay
Comment Utility
Thanx for your help ,
i found a new way to do this task but i have a problem i need when i click over a node and this node has childs then i want to loop through the childs lets say by give me a messages with its childs names ,
thanx alot again :)
0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
:system.TRIGGER_NODE - it is selected by clicking on it.

You can try this:

node:=:system.TRIGGER_NODE;
 
 WHILE NOT Ftree.ID_NULL(node) LOOP
      label_of_node := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_LABEL);
      message(label_of_node);
      pause;
      node := Ftree.Find_Tree_Node(htree, '', Ftree.FIND_NEXT_CHILD,Ftree.NODE_LABEL,node,node);
 END LOOP;
0
 
LVL 22

Expert Comment

by:Helena Marková
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Henka
EE Cleanup Volunteer
0
 

Author Comment

by:loay
Comment Utility
oh sorry for being late but am really sorry that this method didnt work with all nodes it is only working with the first child node not with all childes
0
 

Accepted Solution

by:
amp072397 earned 0 total points
Comment Utility
PAQed, with points refunded (250)

amp
Community Support Cleanup Moderator
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now