Creating a Hierarchical Tree in Forma 6i

Hi Gurus,
We are using forms 6i and oracle 9i. In oracle forms i have one control block and another control block. When we click on one column repname ,the other control block displays the
corresponding info for the sales rep name. eg. Lets say i pick John the salesrep in the other
control block it displays its code,geography region etc.
I want to create a hierarchical tree in the other block where it is displaying the salesrep info.
So i want when i click on the sales rep name(the other control block measure)
then it should the code,geography region etc in the form of hierarchical tree in the other control
block. If the sales rep name is not clicked then the control block having the salesrep info should be hidden.
I would appreciate your help.
Thanks,
PSO

place your treeitem in the layout. The treeitem has to the only item in the block and property "Single record" has to be true.
To populate your tree with data you can either
- use a query to populate a treeitem have a look at this thread Tree Menu
- use the Ftree.Add_Tree_Node built-in and program your own logic.

Similar Messages

  • Problem creating a hierarchical tree in forms builder[issue with the query]

    Hi all,
    I have 2 tables.
    box (box_id, box_name)
    item(item_id, item_name, box_id)
    In a box there are several items.
    I want to create a hierachical tree to display items that are present in each box.
    LIKE:
    |---BOX1
    | |----ITEM 1
    | |----ITEM 2
    |
    |---BOX2
    | |----ITEM 1
    | |----ITEM 2
    Currently i am trying this query:
    SELECT -1 state, box_name, 'icon' icon, box_id val
    from box b, item i;
    I don't know what value to put for level, i don't know how to code the 'connect by prior' part.
    Could you please advise me?
    Michaël.
    PS. Then i will eventually use this query in forms builder.

    Hi MichaelR
    i get the FRM - 47321 error in forms builder ..
    Hence In order to populate a tree, the Select order must retrieve 5 columns:
    STATUS, LEVEL, LABEL, ICON, VALUE u should notice this orders in ur Query this will solve the error and pls notice that the...
    My advice is to use the On Line help in ur forms builder to help u in this ...
    Initial state : number
    Node tree depth : number
    Label for the node : varchar2
    Icon for the node : varchar2
    Data : varchar2This should be in WHEN-NEW-FORM-INSTANCE-trigger in order to populate ur tree...
    another thing why don't u think of building ur tree as i did here in the following example...Pls have a look here ....
    Hope this helps...
    Regards,
    Amatu Allah.

  • Hierarchal tree in FORMS

    Hi,
    I have a hierarchal tree table that I want to represent using forms (insert and update data in the tree table).
    Are there any LINKS or documentation that can help me with my little project :-)
    Thanks,
    Marc.

    The help file has a fairly detailed description of how to manipulate the tree control.
    Provided you have a table that can do this I would do "connect by prior" and "start with" SQL statement and use the pseudo column called "level" to determine when to create a new sub tree and when to end it.

  • Hierarchical trees in forms

    in my oracle forms application i'm working with hierarchical
    trees; every time the tree displays all the nodes are expanded,
    but i want all of them to be collapsed, i tried to set the
    properties of the tree with ftree.collapsed_node, but i only got
    an error message that i didn't select any node.
    Can somebody help me?
    null

    Dear Friend,
    Try this piece of code this will solve your problem
    tree_item:=find_item('your tree item');
    find_node:=ftree.find_tree_node(tree_item,'your_Node_name',
    ftree.find_next,ftree.node_label,
    ftree.root_node,ftree.root_node);
    ftree.SET_TREE_NODE_PROPERTY
    (tree_item,find_node,ftree.node_state,ftree.collapsed_node);
    do the neccessary changes and apply
    bye
    Vishnu Vadla
    null

  • How to call forms using Hierarchical Tree in Forms 10g?

    I know how to call forms from menu that attached to a top form.
    I would like to call forms using Hierarchical Tree. Does any one know how where I can find some instructions on using Hierarcical Tree to call other forms? Any discussion is welcome. Thanks.

    Thanks to Francois.
    The exampe with clear instructions and I can build tree that calls forms now.
    I add a OPEN_FORM statement in WHEN-TREE-NODE-ACTIVATED trigger
    Declare
         LN$I Pls_integer ;
    Begin     
    :Ctrl.Node_Activated := Ftree.Get_Tree_Node_Property('BL_TREE.MENU', :SYSTEM.TRIGGER_NODE, Ftree.NODE_VALUE) ;
    If :Ctrl.Node_Activated IS NOT NULL Then
         Set_Alert_Property( 'AL_CALL_FORM', ALERT_MESSAGE_TEXT, 'Calling module : ' || :Ctrl.Node_Activated ) ;
         LN$I := Show_Alert( 'AL_CALL_FORM' ) ;
         open_form(:Ctrl.Node_Activated);
    End if ;
    End ;
    Or call physical form path by:
         open_form('c:\tree\'||:Ctrl.Node_Activated ||'.fmx');
    I enter the VALUE of MENU as the Form fmx name and it works very well.
    Thanks so much.

  • URGENT *** Hierarchical Tree in Forms 9i *** URGENT

    Hello everybody,
    for my company I need to build a hierarchical tree item, that will display static data over three levels. Let's say: departments, employees and employee projects.
    How do I fill the Item?
    When do I fill the Item?
    Where do I fill the Item?
    What are the elements of the SQL query, that fills the hierarchical tree?
    Any help will be appreciated
    [email protected]

    Note:210663.1 helped a bit.
    I used the database column as the third element in the select part and put NULL as the fifth element. Then it worked.
    Now I am looking for the way to add the employees, when the user selects / activates a department node.

  • Creating a hierarchical tree

    Hi,
    I have 3 tables t1, t2, t3.
    t1 is the master of t2.
    t2 is the master of t3.
    Data in t1:
    seq      name
    1          m
    2          g
    Date in t2
    seq  t1_seq    name
    1         1         mani
    2         1         julia
    3         2        kali
    4         2        mali
    5         2         toli
    data  in t3
    seq  t2_seq    title
    1         1         manager
    2         1         clerk
    3         2        developer
    4         2        clerk
    5         2         salesman
    6         4        manager
    7         4        clerk
    8         2        developer
    9         3        clerk
    10        3         developer---------------------------------------------------------------------------------------------------
    I want the data to print for t1 seq = 1 in the following way:
    mani
           manager
           clerk
    julia
         developer
          clerk
          salesmanI have written the code in the following way but it was not displaying the result. Please correct me where i am going wrong.
    Note: the data should be displayed in hierarchical tree fashion.
    select 1, level, t3.title
    from t2, t3
    connect by prior t2.seq = t3.t2_seq and t2.t1_seq = 1
    start with t3.t2_seq IS NOT NULL;
    Thanks in advance,

    Hi,
    CONNECT BY queries operate on a table (or result set) where every row represents a node.
    In your tables, all the nodes on level 1 are in table t2, but all the nodes on level 2 are in table t3, so you have to do a UNION to make them all appear in a single in-line view.
    WITH
    u     AS
    (     -- Begin in-line view u, UNION of t2 and t3 as hierarchy
         SELECT seq     AS node_id,     -1     AS parent_id,     name          AS label
         FROM t2
         WHERE t1_seq = 1
    UNION ALL
         SELECT NULL     AS node_id,     t2_seq     AS parent_id,     '   ' || title     AS label
         FROM t3
    )     -- End in-line view u, UNION of t2 and t3 as hierarchy
    SELECT     label
    FROM     u
    START WITH     parent_id     = -1
    CONNECT BY     parent_id     = PRIOR node_id
    ;This assumes that -1 is never used as a key in your tables.
    Instead of using LEVEL and L- or RPAD to indent children under their parents, I relied on the fact that all the rows from the same table would be at the same, fixed LEVEL. It might be more efficient to continue that reasoning farther, and consider this problem not as a CONNECT BY query at all, but a master-detail query:
    WITH
    v2     AS
    (     -- Begin in-line view v2, relevant data from t2
    SELECT     seq          AS t2_seq
    ,     -1          AS t3_seq
    ,     name          AS label
    FROM     t2
    WHERE     t1_seq = 1
    )     -- End in-line view v2, relevant data from t2
    SELECT     label,                    t2_seq,     t3_seq
    FROM     v2
    UNION     
    SELECT     '   ' || title     AS label,     t2_seq,     seq AS t3_seq
    FROM     t3
    WHERE     t2_seq IN (SELECT t2_seq FROM v2)
    ORDER BY     t2_seq
    ,          t3_seq
    ;This second query produces the same lable column as the CONNECT BY query above, plus two other columns needed for sorting:
    LABEL             T2_SEQ     T3_SEQ
    mani                   1         -1
       manager             1          1
       clerk               1          2
    julia                  2         -1
       developer           2          3
       clerk               2          4
       salesman            2          5
       developer           2          8You can hide the extra columns with the SQL*Plus "COLUMN ... NOPRINT" command, or you can use another in-line view. (The sorting columns only have to be in the result set of the UNION query itselt.)
    In my results, julia appears with the developer role twice. That seems correct if table t3 includes both of these rows:
    3         2        developer
    8         2        developer

  • Hierarchical tree in forms 10g

    dear member.
    i am a beginner. and want to know about that how to make hierarchical form
    i am using developer suit 10g.
    thanks
    mustafa
    lahore,pakistan

    Mustafa,
    the way u have marked the node_id and parent_node_id in the two tables, it is done at form level. or what... this is a little confusing to me, i have to apply that ht form at other schema.Yes, I create Record Group that populates the HT in the When-New-Form-Instance (WNFI) trigger. You can populate an HT from just about anywhere, but I use the WNFI to ensure the tree is populated when the form loads.
    To add a "Grandchild" node to your tree, you simply need to modify the WNFI trigger and add a Loop for these nodes. Using your data as an example, the code in the WNFI would look something like this (not tested):
    DECLARE
       CURSOR c_comp IS
          SELEC T compcode, name
            FRO M company;
       CURSOR c_div (p_comp NUMBER) IS
          SELEC T div_id, div_name, dept_id
            FRO M s_div
          WHER E compcode = p_comp;
       CURSOR c_dept (IS
          SELEC T dept_id, dept_name
           FRO M s_dept
         WHER E dept_id = p_dept;
       n_level NUMBER := 1;
       n_row NUMBER := 1;
       rg_id  RECORDGROUP;
       node Ftree.Node;
    BEGIN
       Tree_Control.v_item_name := 'MY_TREE_DATA.MY_TREE';
       rg_id := Tree_Control.Create_RG;
       <<parent>>
       FOR r_comp IN c_comp LOOP
          -- Add Parent Company
          Tree_Control.ADD_RG_ROW(rg_id, ftree.collapsed_node, n_row,
                  n_level, r_comp.name, null, r_comp.compcode);
          n_row := n_row + 1;
          n_level := n_level + 1;
          -- Add any child Department records
          <<child>>
          FOR r_div IN c_div(r_comp.compcode) LOOP
             Tree_Control.ADD_RG_ROW(rg_id, ftree.collapsed_node, n_row,
                  n_level, r_div.div_name, null, r_div.div_id);
             n_row := n_row+1;
             -- Now, add any Grandchildren
            <<grandchild>>
            FOR r_dept IN c_dept(r_div.dept_id) LOOP
               Tree_Control.ADD_RG_ROW(rg_id, ftree.collapsed_node, n_row,
                   n_level, r_dept.dept_name, null, r_dept.dept_id);
            END LOOP grandchild;
          END LOOP child;
       END LOOP parent;
       ftree.Add_Tree_Data(Tree_Control.v_item_name, ftree.ROOT_NODE,
                       ftree.PARENT_OFFSET, ftree.LAST_CHILD,
                       ftree.RECORD_GROUD, rg_id);
    END;You will still need to modify the Create_RG function in the Tree_Control package to support the above changes, but this code sample should get you started.
    Craig...

  • Call forms and reports from a hierarchical tree node.

    Hello,
    I am new in pl/sql programming and I have some dificulties. I have created a hierarchical tree, in order to use it as a menu in an application that I am trying to develope. The problem is that I do not know how can I make the last nodes to be either a form or a report and when somebody double clicks on these nodes the form or the report will run. What is more, should I use the when-tree-node-selected trigger or the when-tree-node-activated?
    Thank you in advance,
    Vag

    Hi ,
    In Oracle Forms , a hierarchical tree is developed through the use of a sql statement and column which defines the order of leaves...
    Visit the on-line help of Forms10g to find out the details , and the triggers as well...
    Something else...post this question to Oracle Forms to get more detailed answer...
    Regards,
    Simon

  • Call forms and reports through a hierarchical tree node.

    Hello,
    I am new in pl/sql programming and I have some dificulties. I have created a hierarchical tree, in order to use it as a menu in an application that I am trying to develope. The problem is that I do not know how can I make the last nodes to be either a form or a report and when somebody double clicks on these nodes the form or the report will run. What is more, should I use the when-tree-node-selected trigger or the when-tree-node-activated? I use forms 6i.
    Thank you in advance,
    Vag
    Message was edited by:
    user537672

    Thank you very much for your reply. I tried what you said and managed to create a when-tree-node-activated trigger that works fine. The only problem is that I do not know how to find the last 3 characters of every node in order to make the form understand if it is a form or a report. I mean that the name of each node maybe of different length so I do not know how exactly to use the substr().
    Thank you
    Vag

  • Forms 6 hierarchical Tree

    I would like to Know concept of Hierarchical Tree of forms 6i. What query should be written in the record group to populate the tree and how to implement hierarchical tree to make the form act like Windows Explorer .
    Thank You.

    Read the documentation. Here is a sample query to load the record group.
    PROCEDURE prc_populate_record_group
    IS
    CURSOR g IS
    SELECT groupnum,
    groupnm
    FROM merch_group
    ORDER BY groupnm;
    CURSOR c (l_groupnum NUMBER) IS
    SELECT categorynum,
    categorynm
    FROM merch_group_category
    WHERE groupnum = l_groupnum
    ORDER BY categorynm;
    i NUMBER;
    l_rg_id RECORDGROUP;
    l_init_state GROUPCOLUMN;
    l_level GROUPCOLUMN;
    l_label GROUPCOLUMN;
    l_icon GROUPCOLUMN;
    l_value GROUPCOLUMN;
    l_node ftree.node;
    l_next_node ftree.node;
    l_tree_item ITEM;
    BEGIN
    l_rg_id := FIND_GROUP('PRC_GROUP_CAT');
    IF NOT ID_NULL(l_rg_id)
    THEN
    DELETE_GROUP(l_rg_id);
    END IF;
    l_rg_id := CREATE_GROUP('PRC_GROUP_CAT');
    l_init_state := ADD_GROUP_COLUMN(l_rg_id, 'init_state', NUMBER_COLUMN);
    l_level := ADD_GROUP_COLUMN(l_rg_id, 'level', NUMBER_COLUMN);
    l_label := ADD_GROUP_COLUMN(l_rg_id, 'label', CHAR_COLUMN, 40);
    l_icon := ADD_GROUP_COLUMN(l_rg_id, 'icon', CHAR_COLUMN, 20);
    l_value := ADD_GROUP_COLUMN(l_rg_id, 'value', CHAR_COLUMN, 40);
    i := 1;
    FOR g_rec IN g
    LOOP
    ADD_GROUP_ROW (l_rg_id, i);
    SET_GROUP_NUMBER_CELL(l_init_state, i, -1);
    SET_GROUP_NUMBER_CELL(l_level, i, 1);
    SET_GROUP_CHAR_CELL(l_label, i, g_rec.groupnm&#0124; &#0124;' - '&#0124; &#0124;g_rec.groupnum);
    SET_GROUP_CHAR_CELL(l_icon, i, NULL);
    SET_GROUP_CHAR_CELL(l_value, i, g_rec.groupnum);
    i := i + 1;
    FOR c_rec IN c (g_rec.groupnum)
    LOOP
    ADD_GROUP_ROW (l_rg_id, i);
    SET_GROUP_NUMBER_CELL(l_init_state, i, -1);
    SET_GROUP_NUMBER_CELL(l_level, i, 3);
    SET_GROUP_CHAR_CELL(l_label, i, c_rec.categorynm&#0124; &#0124;' - '&#0124; &#0124;c_rec.categorynum);
    SET_GROUP_CHAR_CELL(l_icon, i, NULL);
    SET_GROUP_CHAR_CELL(l_value, i, c_rec.categorynum);
    i := i + 1;
    END LOOP;
    END LOOP;
    --Find the tree
    l_tree_item := find_item('CONTROL.TREE4');
    -- Assign record group to item causing the data to display
    ftree.set_tree_property(l_tree_item, ftree.record_group, l_rg_id);
    -- Find the root node of the tree
    l_node := ftree.find_tree_node(l_tree_item, '');
    END;
    null

  • Hierarchical tree with iconic nodes

    hi i'm using database - 10g, developer suite - 10g; created a hierarchical tree and the icons are displaying along side the nodes when they are being selected or activated.
    problem - i've stored the icons in g:\ICONS (all gif icons). but when i run the form it is picking up the icons from the following location - C:\Documents and Settings\development\Oracle Jar Cache\frmall_jinit.jar-63ace618-1160d49b\oracle\forms\icons. I've a button in the same form and the icon showing on it is from the location G:\ICONS(as desired); but in case of tree it's from the location which is not desirable.
    any help.

    Hello,
    You need to change the imagebase parameter to be documentbase instead of codebase.
    When imagebase is set to codebase forms looks for Images in the jar files and then in the absolute path, otherwise it check direct path.
    For details in deploying the Images please check:
    http://docs.oracle.com/cd/B14099_19/web.1012/b14032/configure009.htm
    Clear the Java cache and browser cache after the above changes!
    Regards,
    Alex
    If someone's answer is helpful or correct please mark it accordingly!

  • Hierarchical Tree not showing using a record group to populate

    Hi, I am trying to set up an hierarchical tree. Can someone please give me the exact steps I need to take to get this right.
    I am trying to create a hierarchical tree to behave like a menu on a Main form from where I will call the other forms of my application.
    I have done the following
    select 1, level, null, form_name, form_name
    from iso_forms
    connect by prior form_name=action
    start with action is null
    and get this when I run the statement in pl/sql
    1 LEVEL NULL FORM_NAME FORM_NAME
    1 1 Edit Edit
    1 2 Holder Holder
    1 2 Isotopes Isotopes
    1 2 Laboratories Laboratories
    1 2 Personal Personal
    1 2 Incident Incident
    1 2 Equipment Equipment
    1 2 Over Exposure Over Exposure
    1 2 Archive Archive
    1 1 Print Print
    1 1 Queries Queries
    My tree on my main form is still blank, I have checked that the tree is the only item in the block but I am not sure how to confirm that it is a control block. I created the tree in layout editor by clicking on the Hierarchical Tree icon on the left and then dragging out a block, so I am assuming that the block is of the correct type.
    Thank you for your assistance
    Michael

    a control block is one not based on a table/view/procedure . check the block's query data source name. its must be blank.
    I suggest you create a procedure where you create the record_group using
    CREATE_GROUP_FROM_QUERY,populate_group and ftree.set_tree_property
    Here is my code that I i used to populate my tree .it works:
    PROCEDURE populate_the_tree IS
    grp recordgroup;
    error_number number;
    grpname varchar2(20) :='rg_group';
    tree_id item :=find_item('ctrl.tree');
    grp_qry2 varchar2(500) :='select -1,level,ename,null,empno from emp start with mgr is null connect by prior empno=mgr';
    begin
         grp := find_group(grpname);
         if not id_null(grp)
              then delete_group(grp);
         end if;
    --     grp := create_group_from_query(grpname,grp_qry1||grp_qry2);
         grp := create_group_from_query(grpname,grp_qry2);
         error_number:=populate_group(grpname);
         if error_number <> 0
              then message('Error while populating tree');
              raise form_trigger_failure;
         end if;
         ftree.set_tree_property(tree_id,ftree.record_group,grp);
    END;
    Message was edited by:
    lewismak2000

  • Hierarchical Tree IN Oracle FORMS6i and oracle 9i

    Hi ,
    I have written all the scenarios as follows. Please write in steps to do this.
    I have the follwing scenario to create the hierarchical tree.
    The display is as follows when the user comes to this screen.
    CTRLBLK1 CTRLBLK2
    SCOTT This block is hidden
    John
    The way I want it when the user is clicking scott it is displaying the records in the other block
    the full tree expanded not collapasble.
    Scenario1
    CTRLBLK1 CTRLBLK2
    SCOTT President
    VP
    Manager
    Same is over here in scenario2
    Scenario2
    CTRLBLK1 CTRLBLK2
    John President
    VP
    Manager
    Clerk
    The tree should be displayed not collapsed. What is way to do the above
    in forms. I tried to do the way suggested in OTN. But i didnot reached to the solution.
    The way I want it when the user is clicking scott it is displaying the records in the other block
    the full tree expanded not collapasble.
    Pls help.
    Thanks,
    PS

    1) create a item Hierarchical Tree,
    ANS: The tree is created
    2) put this to pull in data to the Tree
    DECLARE
    l_query VARCHAR2(500);
    BEGIN
    l_query := '';
    FTREE.SET_TREE_PROPERTY ( c_tree_blk_item_nm, FTREE.QUERY_TEXT, l_query );
    FTREE.POPULATE_TREE ( c_tree_blk_item_nm );
    go_node ( c_tree_root_node );
    IF FTREE.GET_TREE_PROPERTY (c_tree_blk_item_nm, FTREE.NODE_COUNT ) = 1 THEN
    po_found := FALSE;
    ELSE
    po_found := TRUE;
    END IF;
    END;
    Ans: I wrote this code in WHEN_NEW_FORM_INSTANCE trigger. But the code didnot got compiled . I did cut and paste of query too.
    Pls help me in defining the c_tree_blk_item_nm and go_node ( c_tree_root_node ). I was thinking some code of this type would work.
    The code itself didnot got compiled. It didnot ran.
    3) put this coding into WHEN-TREE-NODE-SELECTED trigger under the item, this is to populate the data to other block when u select the tree node.
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
    GO_BLOCK ( 'BK_AGT' );
    EXECUTE_QUERY;
    SYNCHRONIZE;
    end if;
    BK_AGT is the 2nd control block .
    Help me in solution for this scenario in creating the hierarchical tree in forms6i.
    -KJJJ

  • Colourful Hierarchical Tree

    Hi,
    This is the first thread am posting. I searched ur discussions for "How to show the hierarchical tree in forms 10g with different colours and in different fonts weigth for different nodes". But i found nothing.
    Hopefully looking forward for your replies.

    You should use a less specific search string if you don't find anything first time but in this case it won't have helped you.
    You can set an icon for each node in the tree, which might be an acceptable alternative to writing lots of java.
    The icon can be set as a property
    http://www.oracle.com/webapps/online-help/forms/10g/topics/f1_help/builts/set_tree_node_property_built_in.html?tp=true
    or it can be built into the select statement that creates the tree (if your tree is query-driven).

Maybe you are looking for