How to go to a particular node in a hierarchical tree?

I want to do this simple thing with a Forms hierarchical tree.
Since tree has lots of levels and branches I want to give a search box.
User types the label and press a button. The form then has to query the tree node and expand ONLY the path where the node is (if found) and highlight it. If a node with a label is NOT found I give an error message to the user.
I got hold of a code segment to explode a tree and modified it, but it does not work. The entire tree is expanded and you don't know where you are.
Any help will be greatly appreciated?
PROCEDURE Expand_All_Nodes_in_Tree IS
     node ftree.node;
     htree ITEM;
     state varchar2(30);
BEGIN
     -- Search the tree identifiant --
     htree := Find_Item('menu.tree');
     -- Search the root --
     node := Ftree.Find_Tree_Node(htree, '');
     -- Expand all nodes --
     WHILE NOT Ftree.ID_NULL(node) LOOP
     state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
     IF state = Ftree.COLLAPSED_NODE THEN
     Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.EXPANDED_NODE);
     END IF;
     node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node);
IF Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_LABEL) = :ctrl.node_lable_to_search THEN
EXIT;
END IF;     
     END LOOP;
END;

Hi Channa,
Try this code with you tree i am using the same situation and this code is working perfect with me.
PROCEDURE find_node_in_tree(search_string varchar2, find_type varchar2) IS
htree ITEM;
search_start_node ftree.node;
find_node ftree.node;
BEGIN
htree := Find_Item('blk_tree.main_tree');
     search_start_node := nvl(ftree.get_tree_selection(htree,1),ftree.root_node);
     find_node := ftree.find_tree_node(htree,upper(search_string)||'%',ftree.find_next,ftree.node_label,ftree.root_node,search_start_node-1);
     if find_node = 0 then
          find_node := 1;
end if;
Ftree.Set_Tree_selection(htree, find_node, Ftree.SELECT_ON);
exception
     when others then
          NULL;
END;
-Ammad

Similar Messages

  • How can i change the particular node color in Jtree?

    I have constructed the tree.i dont know how to set the color for the particular node then how can i change the particular node icon depends on some conditions like if we will give the input whether it is available in jtree that node icon only changed.Anyone please help me as soon as possible.

    hi,
    i saw that tutorial.from that book i dont get the particular node cell renderer.i got a cell renderer for tree only.i attached my code in this mail.pls see and help me if u will do
    mport pack.Prop;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Font;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    import java.util.Set;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.text.Position;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.MutableTreeNode;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreePath;
    public class ReadProperty3 extends JFrame{
    String str,key;
    static JTree tree;
    static Vector v;
    StringTokenizer st;
    static DefaultMutableTreeNode root;
    DefaultMutableTreeNode t;     
    public Object[] o;
    public static void main(String[] args) throws IOException {
    ReadProperty3 r = new ReadProperty3();
    Prop p=new Prop();
    JFrame f=new JFrame();
    p.show();
    Object[] o=v.toArray();
    int startRow = 0;
    String prefix =p.s;
    TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward);
    //if(prefix.equals(root.getChildAt(0).toString()))
    if(prefix.equals("2000"))
         System.out.println("Node 2000 found");
         else if(prefix.equals("3000"))
              System.out.println("Node 3000 found");
         else if(prefix.equals("4000"))
              System.out.println("Node 4000 found");
         else
              System.out.println("Node not found");
         for(int i=0;i<v.size();i++)
              //((DefaultTreeModel)tree.getModel()).reload();
              DefaultTreeCellRenderer ren=(DefaultTreeCellRenderer)tree.getCellRenderer();
              Icon openIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon closedIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon leafIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/read.gif");
              if(o[0].equals(p.s))
                   ren.setBackgroundSelectionColor(Color.MAGENTA);
                   ren.setBackgroundNonSelectionColor(Color.YELLOW);
                   //ren.setTextSelectionColor(Color.YELLOW);
                   //ren.setTextNonSelectionColor(Color.BLUE);
                   ren.setClosedIcon(closedIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,14));
              else if(o[1].equals(p.s))
                   ren.setLeafIcon(leafIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,10));
                   UIManager.put("Tree.leafIcon", leafIcon);
              else if(o[2].equals(p.s))
                   ren.setOpenIcon(openIcon);
                   ren.setFont(new Font("Dialog",Font.BOLD,9));
    public ReadProperty3(){
         super("JTree With Properties");
         try{
    int c = 0;
    while(c == 0){
    c = 1;
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter file name which has properties extension :");
    str = bf.readLine();
    File f = new File(str + ".properties");
    if(f.exists()){
    Properties pro = new Properties();
    FileInputStream in = new FileInputStream(f);
    pro.load(in);
    System.out.println("Key: " + pro.keySet());
    System.out.print("Enter Key : ");
    key = bf.readLine();
    String p = pro.getProperty(key);
    st = new StringTokenizer(p,"=,");
    root=new DefaultMutableTreeNode(key);
    v=new Vector();
    while(st.hasMoreTokens())
         String val=st.nextToken();
         v.add(val);
         o=v.toArray();
         System.out.println(val);
         t=new DefaultMutableTreeNode(val);
         root.add(t);
         tree=new JTree(root);
         tree.setEditable(true);
         JScrollPane jp=new JScrollPane(tree);
         // tree.setCellRenderer(new CellRenderer());
         Container content=getContentPane();
         content.add(jp,BorderLayout.CENTER);
    setSize(250,275);
    setVisible(true);
    addWindowListener(new ExitListener());
    else{
    c = 0;
    System.out.println("File not found!");
    catch(IOException e){
    System.out.println(e.getMessage());
    }

  • How to make a node of a Hierarchical Tree BOLD

    When we click the node of a Hierarchical Tree, we want to make the node BOLD. We tried using set item property but it's not working.

    There aren't really any built-ins that will allow you to change the Font Weight of the Tree Node Label. You might be able to accomplish this with Java, but you would have to write your own Java Bean to implement. It might be easier to simply add an Asterisk (*) to the label programatically using the Set-Tree-Node-Property() built-in, but this presents problems with removing the asterisk when you leave the selected node or select a new node. It can be resolved, but you'll have to record all the information you'll need to reset the node - namly just the Node_ID.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.
    Edited by: CraigB on Feb 24, 2012 7:52 AM

  • How to scroll to a specific node in the webdynpro tree

    Hi all,
    I'm developing an application where I need to load and expand a tree upon some action in another view.
    Loading the children, expanding nodes and setting a new lead selection (with cl_wd_dynamic_tool=>set_tree_lead_selection) all works fine.
    But I did not find a way to scroll the tree, so that the node is in the currently visible area of the tree. Is there a way to do this?
    Thanks for your answers!
    Best regards,
      Frank

    Tree is a particular structure, you need to realize a recursive function, specially if the tree with is a recursive TreeNode.
    this is a quickly answer, i did this in java.
    The idea is the same everywhere, this is an ABAP-LIKE solution, understand and translate in a good ABAP source.
    FUNCTION FindNode(TypeNode tree_node, TypeNode node_to_find ).
    IF ( tree_node.ELEMENT_ID EQ node_to_find.ELEMENT_ID ).
    """""""    do what you wanna do  """""
    ELSE.
      n = tree_node.GET_NUMBERS_OF_CHILDS;
      """"""""" RECURSION
      FOR i = 0 TO n.
        child_node = tree_node.GET_CHILD(i).
        CALLFUNCTION FindNode(child_node, node_to_find ).
      ENDFOR.
    ENDIF.
    ENDFUNCTION.

  • How to find out if a NODE has any CHILD NODES in a hierarchical tree?

    I want to find out programmatically if a node in a tree has CHILDREN.
    My requirement is this: I want to only show nodes for which the user has permission to execute the program that node is associated with.
    Problem is, my tree population query will not show the child nodes, BUT the sub-menu nodes are displayed and I need to get rid of these nodes.
    There is a function to find out the PARENT of a tree node (FTree.Get_Tree_Node_Parent), but noting to find out if children exist for a node or not?
    What I thought of was to display the tree and then traverse it from the ROOT onwards and then if a NODE is a submenu node (I can find this out by checking the PROGRAM value. If this is NULL it is a sub-menu node) and IF IT HAS NO CHILD NODES then I can delete the node.

    Please provide the examples with DATA
    as far as i know we cannot get the Child Nodes but NODE's Parents we can get
    parent_node := Ftree.Get_Tree_Node_Parent(htree, :SYSTEM.TRIGGER_NODE);I faced the similar problem but i solved it with query.
    Provide the data and your Tree query then we can help

  • How to do authorizations on unassigned nodes for hierarchies

    Hi,
    Is there a white paper from SAP that shows how to do authorizations for unassigned nodes for the hierarchies? Or has anyone completed this challenge and would be willing to share their approach and strategy?
    Thanks
    Will

    Hi Ashwin,
    The characteristics are 0COSTCENTER and ZDEPT. The Hierarchy structure should be
    -Test Hierarchy
    --Cost center 1
    ---Dept1
    ---Dept2
    ---Dept3
    --Cost center 2
    ---Dept4
    ---Dept5
    ---Dept6
    --Cost center 3
    ---Dept7
    ---Dept8
    ---Dept9
    Etc.
    We have transaction data where a certain Cost center doesn't have the department and when displaying the hierarchy there would be some unassigned nodes for the BW report.
    What would happen if the following hierarchy is in place and I am trying to do authorizations for the 0COSTCENTER and ZDEPT:
    -Test Hierarchy
    --Cost center 1
    ---Dept1
    ---Dept2
    ---Dept3
    --Cost center 2
    ---Dept4
    ---Dept5
    ---Dept6
    --Cost center 3
    Where cost center 3 has no department for it?
    Thanks and regards
    Will

  • Hierarchical Tree Node Attributes

    Hi,
    I know that Oracle' official answer to this is no, but is there a way to specify attributes for specific nodes in a hierarchical tree? I would like to display specific nodes in bold and specific nodes in a different color.
    Any idea welcomed.
    Monica

    If this were possible then you would have to use the FTree package and probably the FTree.Set_Tree_Node_Property procedure, so check those in the help system. But I'm 99.99% sure you'd be wasting your time.
    You might be able to do it with a JTree in a bean (it looks like it's not possible to extend an htree item in a pjc) but in forms the best you can do is assign icons to the nodes.

  • Request a Simple Sample of adding Hierarchical Tree Node

    Hai! if you are familiar with hierarchical tree. please show me
    some sample of adding node to the hierarchical tree(simple
    adding node)
    If you are providing code, please also provide information where
    the code am I suppose to be put cause i'm still new in oracle.
    Thanks in advance for spending some time on it...
    Eric :)
    null

    Here is the code for both the tree node selected and tree node activated triggers
    Tree Node Seleceted code:
    :CONTROL.Node_Activated := null ;
    :CONTROL.Node_Selected := Ftree.Get_Tree_Node_Property('CONTROL_TREE.MENU', :SYSTEM.TRIGGER_NODE, Ftree.NODE_VALUE) ;
    ===========================================================
    Tree Node Activated code:
    Declare
    LN$I Pls_integer ;
    Begin
    :CONTROL.Node_Selected := null;
    :CONTROL.Node_Activated := Ftree.Get_Tree_Node_Property('CONTROL_TREE.MENU', :SYSTEM.TRIGGER_NODE, Ftree.NODE_VALUE) ;
    If :CONTROL.Node_Activated IS NOT NULL Then
    if :GLOBAL.curr_proc_id <> :control.node_activated or :control.node_activated
    is null then                          
    CALL_FORM(:CONTROL.Node_Activated);     
    else
    Set_Alert_Property( 'AL_FORM_OPENED', ALERT_MESSAGE_TEXT,
    :CONTROL.Node_Activated || ' is already opened. Please check your current or previously opened library.' );
    LN$I := Show_Alert( 'AL_FORM_OPENED' ) ;
    end if;          
    end if ;
    end ;

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • How to search in particular node

    hi
    kindly tell how can we limit our search to a particular node instaed of the whole content
    thanks in advance

    Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ
    Attachments:
    Two-stage match demo.vi ‏8 KB

  • Web Dispacher, deactivate a particular node how to?

    Hi,
      Is there any property that can be set in the Web dispatcher profile or the message server, which can stop sending any request to a particular J2ee instance in the cluster?
    The business requirement is that one server (node) in the cluster should not receive any HTTP(s) request from the client, so that this server can be dedicated to run some application intensive routines.
    One way that I have figured out is that we can deactivate a particular node from the Web dispatcher ICM web console, but this is not persisted and the settings go away when the web dispatcher is re started. How can I make it persist?
    Thanks.

    Hi Sukanya,
    Did you ever resolve this problem? We too want to deactivate a server from the Web dispatcher. We also need to connect directly to it as you require. When we used Gary's method of Config Tool --> Server_ID####### --> Debug --> Debuggable --> Restricted Load Balancing, we are also unable to connect to that node directly.
    I have read through the Web dispatcher online Help. The mention creating groups but they all seem to pertain to ABAP groups using SMLG. Our Web dispatcher is used in a stictly J2EE environment.
    There must must be a Profile setting or some config to restrict specified nodes... Let me know if you have found out?
    Thank You,
    Jon Sells

  • How to use xpath function to select some particular  nodes

    Dear experts:
    does abap supports  xpath  to sellect particular  nodes  according some node value or condition, i know other  programe language  supports the function selectNode(xpath expression)  , does abap or have the api to support it?
    and i know there is a class support  the xpath but it's not work., the class this:cl_xslt_processor
    to clarify my point. i take a ex.
    the xml doc is follow:
    <?xml version="1.0" encoding="utf-8" ?>
    - <n0:MT_CRM_Req xmlns:n0="http://gome.com/CRM/CRM/Outbound" xmlns:prx="urn:sap.com:proxy:DC0:/1SAI/TAS05C79364B9D0DC5F6738:701:2010/02/19">
    <company name="hp">
    <dep name="gds">
    <empolyeeid>123</empolyeeid>
    </dep>
    <dep name="its">
    <empolyeeid>148</empolyeeid>
    </dep>
    </company>
    <company name="foxconn">
    <dep name="fih">
    <empolyeeid>569</empolyeeid>
    </dep>
    </company>
      </n0:MT_CRM_Req>
    i  want to  select the employee 's company name who empolyee id is 123
    i use the method  ,and the code is :
    l_xslt->set_expression(
    expression = '/n0:MT_CRM_Req/n0:company[n0:dep/n0:empolyeeid=123]'
    nsdeclarations = 'n0 http://gome.com/CRM/CRM/Outbound'
    l_xslt->run('').
    nodes = l_xslt->get_nodes( ).
    LEN = nodes->GET_LENGTH( ) .
    WRITE LEN.
    but no nodes return.
    is anybody knows what's wrong with it? or there is some other api to manipulate the xml dom.
    best regrds!

    Hello Kevin ,
    i think you can get those details , have a look at program BCCIIXMLT1, i think this program will give you some idea to handle * manage xml docs.
    along with that program ...you need to put filter
    *---creating filers.
      filter   = document->create_filter_name( name = 'Company' ).
      iterator = document->create_iterator_filtered( filter ).
      main_node =  document.
    *---processing document.
      perform print_node using main_node p_flag.
    let me know if you need anymore help.
    regards
    Prabhu

  • How to rename a particular node in an xml

    Hi All,
    I have a table called xmltable and I have inserted the below row in to the table,
    INSERT INTO XMLTABLE VALUES (4,'<?xml version="1.0"?>
    <Node_1 empID="202" empName="Pro1" oper="Update">
    <Node_2 empID="20" empName="Pro2" oper="Update">
    <Node_3 empID="2" empName="Pro3" oper="Update">
    <Node_4 empID="22" empName="Pro4" oper="Update">
    <Node_5 empID="12" empName="Pro5" oper="Delete"/>
    <Node_6 empID="223" empName="Pro6" oper="Insert"/>
    <Node_7 empID="201" empName="Pro7" oper="All"/>
    </Node_4>
    </Node_3>
    </Node_2>
    </Node_1>');
    I Have created a sequence seq_i
    I want to replace a particular node with next sequence seq_i,
    Ex: - Assume I want to replace only 'Node_2' with 'seq_i.nextval',
    Can any one help me in acheiving this?
    Thanks,

    Sorry for the inconvenience, Below Find detailed explanation of the issue,
    INSERT INTO XMLTABLE VALUES (4,'<?xml version="1.0"?>
    <Node_1 empID="202" empName="Pro1" oper="Update">
    <Node_2 empID="20" empName="Pro2" oper="Update">
    <Bode_3 empID="2" empName="Pro3" oper="Update">
    <Bode_4 empID="22" empName="Pro4" oper="Update">
    <Bode_5 empID="12" empName="Pro5" oper="Delete"/>
    <Bode_6 empID="223" empName="Pro6" oper="Insert"/>
    <Bode_7 empID="201" empName="Pro7" oper="All"/>
    <Node_3 empID="21" empName="Pro71" oper="ll">
    </Bode_4>
    </Bode_3>
    </Node_2>
    </Node_1>');
    I have a sequence seq_i
    seq_i start with 1 increment by 1
    am able to display output as below,
    Node|EMPID|OPER|EMPNAME|MGRID
    Node_1|202|Update|Pro1|Null
    Node_2|20|Update|Pro2|Node_1
    Bode_3|2|Update|Pro3|Node_2
    Bode_4|22|Update|Pro4|Bode_3
    Bode_5|12|Delete|Pro5|Bode_4
    Bode_6|223|Insert|Pro6|Bode_4
    Bode_7|201|All|Pro7|Bode_4
    Node_3|21|ll|Pro71|Bode_4
    Now I want below one as output
    All nodes starting with Bode_, I need to replace that with sequence, seq_i
    so for the seq_i (starting with i and incrementing by 1)
    Node|EMPID|OPER|EMPNAME|MGRID
    Node_1|202|Update|Pro1|Null
    Node_2|20|Update|Pro2|Node_1
    1|2|Update|Pro3|Node_2
    2|22|Update|Pro4|1
    3|12|Delete|Pro5|2
    4|223|Insert|Pro6|2
    5|201|All|Pro7|2
    Node_3|21|ll|Pro71|2
    Thanks,

  • Debug a particular node of SMARTFORM

    Hai Fellas,
    How to debug a particular node of Smartforms.
    I dont want to debug it from the begining.
    There is a restiction I can't add anything as the code is in Quality server.
    i.e no break points can be hardcoded using program line.
    Best Regards,
    Suvendu.

    Hi,
    Just for debugging you cant write break-point statement and u cant transport,the best practice is go to smartforms ,there will be a option find the function module.Go to Se37 give the function module name,go to display mode,search for ur field or internal table or a work area,keep the break-point ,and then run the smart form ,this is way that we can debug in quality and production systems
    Thanks
    Santhiya B

  • Hierachical tree - Highlight particular node's in Tree

    Is there any way to bold or change the colour of particular nodes in a tree?
    We know and use the node icon to distinguish between them but ideally would want to bold some to highlight areas
    I can not see how to do this looking at the documentation but may be wrong.
    Thanks

    Thanks thats what i thought but hoped i was wrong.

Maybe you are looking for

  • Safari on Windows XP Pro?

    Hey everyone This is my first time using the forums here and I was just wondering if it's possible to use Safari on Windows XP. If anyone would have an answer to this would you be able to provide a link to a download page, it would be much appreciate

  • Re: Error in PL/SQL region for Shuttle item.

    Hi, I have following PL/SQL in the Region Source: DHTML_SHUTTLE ( pSQL_1=>'select "substr(tab_label,1,30)","substr(tab_name,1,25)" from "apex_application_tabs" where workspace = "R&D" and application_name = "home" and tab_set = "T1" order by "tab_lab

  • Bubbles to the Right of inbox, drafts and sent

    I am running 10.4.7 and have had problems ever since I installed the 10.4.7 update in June. Next to the inbox, drafts and sent workding are blue and white overlapping circles that should not appear there. I have verified and repaired the disk permiss

  • On change of

    Hi, i want to use on change of instead of AT NEW cause the itab-field blnr has n index and every time when this index changes the AT NEW command makes a group change and this is not correct. so i want to use the ON CHANGE OF command but i don't know

  • Offline backup fail

    Hi, Offline back is getting failed due to the following error in test server where as online backup is successful. BR0069E File name /oracle/QAS/sapdata1/temp_1/temp.data1 not unique - backup/verification not possible BR0069E File name /oracle/QAS/sa