Wednesday, December 7, 2011

CALLING A FORM TO ANOTHER FORM IN ORACLE D2K/FORMS/10G


CALLING FORMS AT RUN TIME (FORM TO FORM CALLING IN ORACLE D2K)
This  topic is related to how you can call another form from existing form. Very important topic in Oracle d2k.
1.       We can call forms at run times in  three ways.
2.       Call_form:- it opens the form in model window mode i.e unless and until we close the called form , we cannot go back to the calling form.
3.       Open_form:- this open the form in modeless mode i.e we can work on both calling form and called form at the same time without closing any them.
4.       New_form:- this always close the calling form (ex. On successful login , the login screen closed and the application open).

All these three methods take on mandatory parameter i.e the complete path of FMX file to be called.

General points needs to be remember.
We need to add parameter for passing the values to different form. Four thing we need to be remember always.
1.       Declare parameter.
2.       Create parameter.
3.       Add parameter.
4.       Call form/open form/new form
5.       Destroy parameter.

Example :- I am writing a code which will illustrate you how we can call a form from another form.
DECLARE
P PARAMETER;
BEGIN
P:= CREATE_PARAMETER_LIST(‘ABC’);
ADD_PARAMETER(P,’P_EMPDEPTNO’,TEXT_PARAMETER,:DEPT.DEPTNO);
CALL_FORM(‘C:\EMP.FMX’,NO_HIDE,NO_REPLACE,NO_QUERY_ONLY,P);
DESTROY_PARAMETER_LIST(P);
END;
PARAMETER PASSING BETWEEN FORMS
WE CAN PASS VALUES FROM ONE FORM TO ANOTHER FORM WITH THE HELP OF PARAMETER.
STEPS:
1.       CREATE A FORM MODULE(CALLED FORM).
2.       CREATE A BASE TABLE BLOCK.
3.       CREATE A PARAMETER IN THE FORM.
4.       IN THE PROPERTY AND PARAMETER MENTION NAME, DATATYPE.
5.       IN A WHENNEW BLOCK INSTANCE TRIGGER OF THE BLOCK MENTION THE FOLLOWING
SET_BLOCK_PROPERTY(‘EMP’,DEFAULT_WHERE,’DEPTNO:=’||:PARAMETER.P_EMP_DEPTNO);
EXECUTE_QUERY;
6.       SAVE, COMPILE AND COMPILE THE FORM.
7.       CREATE THE NEW FORM .


2 comments: