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 Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/043a1274cb670fd010565969fc56603d?s=64&d=mm&r=g) |
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 #608702 is a reply to message #608665] |
Sun, 23 February 2014 00:02 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/149761.png) |
deepakmannazhi
Messages: 137 Registered: February 2010 Location: Dubai, UAE
|
Senior Member |
![deepakmannazhi@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
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
|
|
|
|
Goto Forum:
Current Time: Mon Aug 26 09:01:08 CDT 2024
|