[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 596
  • Last Modified:

trees

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
loay
Asked:
loay
  • 6
  • 4
1 Solution
 
Helena Markováprogrammer-analystCommented:
All answers you can find in the on-line help - "Manipulating a hierarchical tree at runtime" topic. There are also examples there.
0
 
loayAuthor Commented:
but how can i set defferent icons for the data i bring from the database this is the main problem i am facing
0
 
Helena Markováprogrammer-analystCommented:
/*  
** 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
loayAuthor Commented:
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
 
Helena Markováprogrammer-analystCommented:
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
 
Helena Markováprogrammer-analystCommented:
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
 
loayAuthor Commented:
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
 
Helena Markováprogrammer-analystCommented:
: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
 
Helena Markováprogrammer-analystCommented:
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
 
loayAuthor Commented:
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
 
amp072397Commented:
PAQed, with points refunded (250)

amp
Community Support Cleanup Moderator
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now