call_forms with parameters [message #82227] |
Thu, 08 May 2003 13:53 |
HG
Messages: 13 Registered: December 2002
|
Junior Member |
|
|
Hello,
I want to call a form from another form and i want to place the second form on a record that i select in the first form.
I'm working with oracle forms builder 6.
I tried the call_form and i used a global variable. In the WHEN_NEW_FORM_INSTANCE trigger of the second form, i tried a enter_query and i place the global var in the desired field before a execute the query with execute_query.
eg.
WHEN_NEW_FORM_INSTANCE
enter_query;
:datablock.field := :global.parameter;
execute_query;
this doesn't work. How can i execute a query (or search a desired field) at once, on opening it from another form.
Thank in advance
HG the novice.
|
|
|
Re: call_forms with parameters [message #82229 is a reply to message #82227] |
Fri, 09 May 2003 02:53 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
I have 2 modules: Module1 (based on DEPT) and Module2 (based on EMP). If I start Module1 and query a department I can push a button which calls Module2 to display all employees in the given department. In order to achieve this I have made the following modifications in Module1 (calling form): Added a push-button with the following code in the WHEN-BUTTON-PRESSED trigger:
----------------------------------------------------------------------
DECLARE
pl_id PARAMLIST;
theformname VARCHAR2(20);
BEGIN
theformname := 'Module2';
pl_id := GET_PARAMETER_LIST('tempdata');
IF NOT ID_NULL(pl_id) THEN
Destroy_Parameter_List('tempdata');
END IF;
pl_id := CREATE_PARAMETER_LIST('tempdata');
Add_Parameter(pl_id, 'P_DEPTNO', TEXT_PARAMETER, :DEPT.DEPTNO);
CALL_FORM(theformname, hide, no_replace, query_only, pl_id);
END;
----------------------------------------------------------------------
In Module2 (called form), I have added a numeric parameter P_DEPTNO. I can refer to this parameter using :PARAMETER.P_DEPTNO. In my default where clause of the block EMP in module2 I have added the following default where clause: deptno = NVL(:PARAMETER.P_DEPTNO,deptno). The NVL makes sure that even a call with an empty parameter will pass.
HTH,
MHE
|
|
|
|