Home » Developer & Programmer » Forms » call my form by tree
call my form by tree [message #608639] Fri, 21 February 2014 08:56 Go to next message
hassan08
Messages: 122
Registered: June 2011
Location: egypt
Senior Member
i have table consists of
form_id
for_name
how can build the tree and how can too call this screen by the tree
Re: call my form by tree [message #608642 is a reply to message #608639] Fri, 21 February 2014 09:59 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A tree requires hierarchical model. Your table does not support it. There should be parents and their children. Alter the table; search the Internet and/or this forum - there should be quite a few hits for Forms trees.
Re: call my form by tree [message #608665 is a reply to message #608639] Fri, 21 February 2014 15:53 Go to previous messageGo to next message
hassan08
Messages: 122
Registered: June 2011
Location: egypt
Senior Member
you can give me example on schema Scott or hr
and i looking on the internet but not found result to executing my request
Re: call my form by tree [message #608702 is a reply to message #608665] Sun, 23 February 2014 00:02 Go to previous messageGo to next message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Dear Hassan,

Please go through the example. This may help you



CREATE TABLE fzexprd_dba.test_menu ( menu_id VARCHAR2(20 BYTE), parent_id VARCHAR2(20 BYTE), form_name VARCHAR2(50 BYTE), menu_name VARCHAR2(50 BYTE) );



Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M1', NULL, NULL, 'Sales');
Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M2', NULL, NULL, 'Purchase');
Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M3', NULL, NULL, 'Stores');
Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M4', 'M1', 'FORM1.fmx', 'Sales Invoice');
Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M5', 'M2', 'FORM2.fmx', 'Purchase Invoice');
Insert into FZEXPRD_DBA.TEST_MENU
   (MENU_ID, PARENT_ID, FORM_NAME, MENU_NAME)
 Values
   ('M6', 'M3', 'FORM3.fmx', 'GRN');




tree query

select 1, level, menu_name ,NULL, menu_id 
                                 from test_menu 
                                 connect by prior menu_id=parent_id
                                 start with parent_id is null  



When-new-Form_Instance
 

DECLARE
   htree      item;
   v_ignore   NUMBER;
   rg_emps    recordgroup;
BEGIN
   htree := FIND_ITEM ('TREE_BLOCK.TREE4');
   rg_emps := FIND_GROUP ('RG_TREE');

   IF NOT ID_NULL (rg_emps)
   THEN
      DELETE_GROUP (rg_emps);
   END IF;
   rg_emps :=   
      CREATE_GROUP_FROM_QUERY
                           ('RG_TREE',
                               ' select 1, level, menu_name ,NULL, menu_id 
                                 from test_menu 
                                 connect by prior menu_id=parent_id
                                 start with parent_id is null  '
                           );    
     v_ignore := POPULATE_GROUP (rg_emps);
     ftree.SET_TREE_PROPERTY (htree, ftree.record_group, rg_emps);
END;


     
         
         



Tree Block's When-Mouse-Double-Click (Calling form in double click event)

DECLARE
  htree item;
  node_selected NUMBER;
  current_node ftree.node;
  node_state VARCHAR2(5);
  node_value VARCHAR2(20);
   v_form_name varchar2(50);
  CURSOR c_formname(p_menu VARCHAR2)
  IS select form_name 
  from  test_menu
  where menu_id=p_menu;
    
BEGIN
  htree           := Find_Item('TREE_BLOCK.TREE4');
  node_selected   := Ftree.Get_Tree_Property(htree, Ftree.SELECTION_COUNT);
  IF node_selected > 0 THEN	
    current_node  := Ftree.Get_Tree_Selection(htree, node_selected);
    node_state    := Ftree.Get_Tree_Node_Property(htree, current_node,Ftree.NODE_STATE);
    IF node_state =Ftree.LEAF_NODE THEN
      node_value  := Ftree.Get_Tree_Node_Property(htree, current_node, Ftree.NODE_VALUE);
      OPEN c_formname(node_value);
      FETCH c_formname INTO v_form_name;
      CLOSE c_formname;
    END IF;
   /*
   Call_form (v_form_name);
   
   *Here you can follow your logic*
   
   */   
  END IF;
END ;





Regards
Deepak
Re: call my form by tree [message #608703 is a reply to message #608702] Sun, 23 February 2014 00:06 Go to previous message
deepakmannazhi
Messages: 137
Registered: February 2010
Location: Dubai, UAE
Senior Member

Please see the image also
  • Attachment: treemenu.png
    (Size: 19.99KB, Downloaded 925 times)

[Updated on: Sun, 23 February 2014 21:42]

Report message to a moderator

Previous Topic: foms
Next Topic: ORACLE FORMS AND REPORTS ON MOBILE DEVICES
Goto Forum:
  


Current Time: Fri Apr 26 15:33:27 CDT 2024