Solved

Again tree

Posted on 2004-03-30
11
1,411 Views
Last Modified: 2013-12-12
Hello, I came back with my question about hierarchical tree.

htree := Find_item('MyTree');
      
new_node := Ftree.Add_tree_node(htree,
                  Ftree.root_node,                                                                        Ftree.parent_offset,                                                                      Ftree.last_child,
                  Ftree.expanded_node, 'Aerodromai',null,'Aero');
 
   Ftree.Add_Tree_Data(htree,      new_node,
                                      Ftree.PARENT_OFFSET,
                     Ftree.LAST_CHILD,
                     Ftree.QUERY_TEXT,
                     'SELECT 0, 1, AERO_PAV, NULL, to_char(AERO_ID) FROM T_AERO' );

And my question is:

I need to add some more nodes in the same level (not parent, but his child) how to get that valid node witch is added child and
add more data?

Please help me

Solveiga
0
Comment
Question by:Solve
[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
  • 7
  • 4
11 Comments
 
LVL 1

Author Comment

by:Solve
ID: 10713201
How to find a node, to witch I want to add more nodes?

Solveiga
0
 
LVL 6

Expert Comment

by:musdu
ID: 10713488
Solve,

Forms Builder help has a good example about finding a tree node;

/*  

** Built-in:  FIND_TREE_NODE
*/

-- This code finds a node with a label of "Doran"
-- within the subtree beginning with the a node
-- with a label of "Zetie".

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


   -- Find the node with a label "Zetie".
   find_node := Ftree.Find_Tree_Node(htree, 'Zetie', Ftree.FIND_NEXT,
                 Ftree.NODE_LABEL, Ftree.ROOT_NODE, Ftree.ROOT_NODE);

   -- Find the node with a label "Doran"
   -- starting at the first occurance of "Zetie".
   find_node := Ftree.Find_Tree_Node(htree, 'Doran', Ftree.FIND_NEXT,
                Ftree.NODE_LABEL, find_node, find_node);

   IF NOT Ftree.ID_NULL(find_node) then
      ...
   END IF;
END;


0
 
LVL 1

Author Comment

by:Solve
ID: 10713669
But you know, I don't if I add data like this:

  Ftree.Add_Tree_Data(htree,     new_node,
                                    Ftree.PARENT_OFFSET,
                  Ftree.LAST_CHILD,
                  Ftree.QUERY_TEXT,
                  'SELECT 0, 1, AERO_PAV, NULL, to_char(AERO_ID) FROM T_AERO' );
and I need to add a node exactly to that node with value is AERO_ID....

How can I find_node when I don;t know label? Could you help?

Solveiga
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 6

Expert Comment

by:musdu
ID: 10714100
Solve,

where do you want to add the data? Do you want to add a new node or new data under a node? I think your tree same as the below one?

Root
   MyNode1
          mydata1
          mydata2
          mydata3
   MyNode2
          mydata21
          mydata22
0
 
LVL 1

Author Comment

by:Solve
ID: 10721058
Good morning :)

Look there I want to add one more node:

Root
   MyNode1
          mydata1
               new_node
          mydata2
               new_node
          mydata3
               new_node
   MyNode2
          mydata21
          mydata22

Is it possible?

Solve
0
 
LVL 1

Author Comment

by:Solve
ID: 10721164
Yes yes, my tree looks exactly like you said
I create node with some new nodes:
MyNode1
MyNode2
then to MyNode1 I add data from one table
to MyNode2 I add data from second table and I have:

Root
   MyNode1
          mydata1
          mydata2
          mydata3
   MyNode2
          mydata21
          mydata22

And also I want to put some more information from my others table and I want to create nodes
Like (e.g. all units associated with my first node's data)
Units will be from third table witch is connected with my T_AERO via AERO_ID

Root
   MyNode1
     mydata1
        units
          unit1
          unit2
          unit3
          ...
     mydata2
        units
          unit1
          unit2
          unit3
          ...
   MyNode2
      mydata21
        units... (this would be the same like forst node, but not nessasary)

Is it possible to do that?
Solve
0
 
LVL 6

Accepted Solution

by:
musdu earned 50 total points
ID: 10721338
Goodmorning,

I think mydata1 represents AERO_ID in this example? I do not know name of your other table but let's say MYTABLE (having columns AERO_ID and UNIT)


DECLARE

   htree   ITEM;
   find_node FTREE.NODE;
   
BEGIN

-- Find tree

htree := Find_item('MyTree');

-- We need to find nodes

FOR vMyTable IN (SELECT DISTINCT AERO_ID IN MYTABLE) LOOP

   find_node := Ftree.Find_Tree_Node(
      htree,
      vMyTable.Aero_Id,
      Ftree.FIND_NEXT,
      Ftree.NODE_VALUE,
      Ftree.ROOT_NODE,
      Ftree.ROOT_NODE);

   -- We found the node

   IF NOT Ftree.ID_NULL(find_node) then
      Ftree.Add_Tree_Data(
         htree,
         find_node,
         Ftree.PARENT_OFFSET,
         Ftree.LAST_CHILD,
         Ftree.QUERY_TEXT,
         'SELECT 0, 1, UNIT, NULL, UNIT FROM MYTABLE WHERE ARO_ID ='||vMyTable.Aero_Id);
  END IF;

END LOOP;

END;




0
 
LVL 1

Author Comment

by:Solve
ID: 10721481
And I also need to add that node - units (from my example)
But now I think I will manage this with your help!!

Thank you very much, musdu

Solve
0
 
LVL 1

Author Comment

by:Solve
ID: 10721491
Could you please say me one more think? How?

I need to add this units to finded node as a new node?

Solve
0
 
LVL 6

Expert Comment

by:musdu
ID: 10721562
If you want to add them as new nodes instead of data use Add_Tree_Node built-in;


DECLARE

   htree   ITEM;
   find_node FTREE.NODE;
   
BEGIN

-- Find tree

htree := Find_item('MyTree');

-- We need to find nodes

FOR vMyTable IN (SELECT DISTINCT AERO_ID IN MYTABLE) LOOP

   find_node := Ftree.Find_Tree_Node(
      htree,
      vMyTable.Aero_Id,
      Ftree.FIND_NEXT,
      Ftree.NODE_VALUE,
      Ftree.ROOT_NODE,
      Ftree.ROOT_NODE);

   -- We found the node

   IF NOT Ftree.ID_NULL(find_node) then

      -- Add units as nodes

      FOR vUnits IN  (SELECT DISTINCT AERO_ID IN MYTABLE WHERE AERO_ID = vMyTable.Aero_Id) LOOP

         new_node := Ftree.Add_Tree_Node(htree,
                                   find_node,
                                   Ftree.PARENT_OFFSET,
                                   Ftree.LAST_CHILD,
                                   Ftree.EXPANDED_NODE,
                                   vMyTable.Unit,
                                   NULL,
                                  vMyTable.Unit);
       END LOOP;
 
END IF;

END LOOP;

END;


regards.
0
 
LVL 1

Author Comment

by:Solve
ID: 10721604
Thanks again:)

You rescued me!!!!!!

Solve
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

626 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