Solved

trees

Posted on 2003-12-07
11
590 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
11 Comments
 
LVL 22

Expert Comment

by:Helena Marková
ID: 9894882
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
ID: 9895347
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á
ID: 9895874
/*  
** 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:loay
ID: 9897131
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á
ID: 9902124
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
 
LVL 22

Expert Comment

by:Helena Marková
ID: 9902582
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
ID: 9910465
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á
ID: 9910845
: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á
ID: 10279974
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
ID: 10296869
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
ID: 10347674
PAQed, with points refunded (250)

amp
Community Support Cleanup Moderator
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

688 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