Tuesday, March 31, 2009

Passing Parameters from one form to another in Oracle Forms

FORM parameters are of three TYPE char,number, or date .

Follow this steps to pass the parameters.

1.Create a parameter list in the in the calling form


Example


DECLARE
pl_id paramlist;
city_name VARCHAR2 (30) := 'calicut';
city_date DATE := SYSDATE;
BEGIN
pl_id := GET_PARAMETER_LIST ('tempdata');

IF NOT ID_NULL (pl_id)
THEN
DESTROY_PARAMETER_LIST (pl_id);
END IF;

pl_id := CREATE_PARAMETER_LIST ('tempdata');
ADD_PARAMETER (pl_id, 'p_city', text_parameter, city);
ADD_PARAMETER (pl_id, 'p_city_date', text_parameter, TO_CHAR (city_date));
/* Please note that here you can pass only Text i.e., CHAR parameters, that
means if it is other than CHAR you have to convert into CHAR function */
--call the form with parameter
CALL_FORM ('XYZ_FORM', hide, no_replace, no_query_only, pl_id);
END;


2.Create two parameter in the called form with the same name u given for the parameters
in the parameter list .For to do it

  1. In XYZ_FORM, Click on PARAMETERS.
    2. Go to the property sheet of PARAMETER1
    Change the following things
    i) Name = P_CITY /* It must be the same name that what you are passing */
    ii) Data Type = CHAR
    iii) Maximum Length = 30 //sample
    iv) Close the parameter sheet.

    3. Similarly Create one more parameter for P_City_date by clicking "new".
    i) Name = P_CITY_DATE /* It must be the same name that what you are passing */
    ii) Data Type = DATE
    iii) Close the parameter sheet.

So the parameters are

1. P_City
2. P_city_date

3.Access the values of the above parameter in the called form


To access the values of the above parameters in the XYZ_FORM
append with :PARAMETER.
That is
You can access P_City in Xyz_form by :PARAMETER.P_CITY
Similarly for P_City_Date is :PARAMETER.P_CITY_DATE.

6 comments:

  1. thanks for giving such nice explanation using example ......

    vikram

    ReplyDelete
  2. Thank you! Brilliant explanation.

    ReplyDelete
  3. What about number parameter, you wrote:
    "FORM parameters are of three TYPE char,number, or date "
    but no example for number parameter ?
    I ask because also online forms does not said anything about number parameter Q$%$#%234

    Please explain how is used, any why everyone is "hiding" it (not mentioning nor explaining)

    Thank you

    ReplyDelete
  4. Casino | Dr. Gamble MD
    Welcome 포천 출장샵 to the 경주 출장샵 Casino Dr. Gamble MD in Washington, DC. See Dr. Gamble MD's profile, Visit us today 영주 출장샵 and bet and win on all your favorite casino games 전주 출장샵 at Dr. Gamble! 광주광역 출장마사지

    ReplyDelete