iSelfSchooling.com - Since 1999  References  |  Job Openings
    Home  | Search more  | Oracle Syntax  | Computer Institute   | (Login or Register to access to VIDEOS)
 

Copyright & User Agreement

   Suggestions Email2aFriendHomepage us! |  Bookmark

Services

  Vision/Mission

  Services

  Biography

  Contact Us

 FREE Training

  Start...

  SQL

  PL/SQL

  Forms 

  Reports

  DBA Fundamentals

  Performance

  Prepare for OCP

  ShareUrNotes

...

  Acknowledgement

  Who is who

  University Directory

  Links...

 

 

 

FREE Online Oracle Training for beginners and advanced - The most comprehensive Oracle tutorial

The authors do not guarantee or take any responsibility for the accuracy, or completeness of the information.

BASICS

SQL | PL/SQL

DEVELOPERS

FORMS 2 | REPORTS | Other TOOLS

DBAs

FUNDAMENTALS 2 | PERFORMANCE | OEM

ADVANCE

APPLICATION SERVER | GRID CONTROL | ARTICLES 2 3 4

Advanced - Articles II

Lesson 01 | Lesson 02 | Lesson 03 | Lesson 04 | Lesson 05 | Lesson 06 | Lesson 07 | Lesson 08 | Lesson 09 | Lesson 10 | Lesson 11 | Lesson 12 | Lesson 13 | Lesson 14 | Lesson 15 | Lesson 16 | Lesson 17 | Lesson 18 | Lesson 19 | Lesson 20 | Lesson 21 | Lesson 22 | Lesson 23 | Lesson 24 | Lesson 25 | Lesson 26 | Lesson 27 | Lesson 28 | Lesson 29 | Lesson 30 | Lesson 31 | Lesson 32 | Lesson 33 | Lesson 34 | Lesson 35 |

Lesson 29

"The future belongs to those who believe in the beauty of their dreams." 

-Eleanor Roosevelt (1884-1962)

How to create, use, and pass a parameter list in FORMS?

With the previous versions of Forms, the way to pass values between different forms was using Global variables.  Now there is a flexible way to pass values between forms. You can create your own parameter list programmatically and pass it as an argument in a CALL_FORM or OPEN_FORM. 

 

How to Create a Parameter List

=======================

With the previous versions of Forms, the way to pass values between different forms was using Global variables.  Now there is a flexible way to pass values between forms. You can create your own parameter list programmatically and pass it as an argument in a CALL_FORM or OPEN_FORM.

 

Use the following built-ins functions and procedures to manipulate parameter lists:

 

-- CREATE_PARAMETER_LIST:  creates an empty parameter list.

-- ADD_PARAMETER:  adds a parameter to an existing parameter list.

-- GET_PARAMETER_LIST:  determines if there is already a parameter list with

                        the same name as the one you are trying to create.

-- DESTROY_PARAMETER_LIST:  destroys a parameter list.

-- DELETE_PARAMETER:  deletes a parameter in the parameter list.

 

Lets illustrate the use of these built-ins functions and procedures.

Suppose that you need to pass the customer ID from one form (CUSTOMERS) to another form (PORTFOLIO); you use the CUSTOMER ID to query all customer’s stocks portfolio in the portfolio table in the called form. You can execute the following code from a “WHEN-BUTTON-PRESSED” trigger or even from a menu item:

 

DECLARE

     param_list_id  ParamList;   -- Define an object of type paramlist

BEGIN

     param_list_id := GET_PARAMETER_LIST(‘my_parameter');

     -- Test if the parameter list already exists.

     IF NOT ID_NULL(param_list_id) THEN

          DESTROY_PARAMETER_LIST(param_list_id);

     END IF;

     param_list_id := CREATE_PARAMETER_LIST('my_parameter');

     ADD_PARAMETER(param_list_id, 'p_customer_id', TEXT_PARAMETER, :ID);

     CALL_FORM('c:\portfolio', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY, param_list_id);

END;

 

You must declare an object of type ParamList. 

 

Also, all parameters that you define in the Object Navigator belong to the default parameter list.  You can also pass the default parameter list to another form if you need. For example:

 

WHEN-BUTTON-PRESSED

 

BEGIN

   CALL_FORM('employee', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY, 'default');

END;

 

When passing the default parameter list as well as any other parameter list, make sure that every parameter exists with the same name in the called form.

 

How to Access the Value of a Parameter in a Called Form

=======================================================

To access the value of a parameter in a called form, you must create the following triggers in the employee form:

 

WHEN-NEW-FORM-INSTANCE at the form level

 

In addition, create a parameter with the same name as the parameter that you are passing in the parameter list.  If you fail to do this, the application returns an error message that the parameter does not exist.

 

The following is an example of a trigger needed to do a query based on the

value passed in the parameter list when the form 'portfolio’ is called:

 

WHEN-NEW-FORM-INSTANCE

 

BEGIN

    -- Obtain the name of the calling form

    form_name := GET_APPLICATION_PROPERTY(CALLING_FORM);

    IF form_name IS NOT NULL THEN

          -- Execute a query if the form is a called form

          EXECUTE_QUERY;

    ELSE

          :parameter.p_customer_id := 10;

    END IF;

END;

 

How to Create a Parameter

=========================

Follow this procedure to create a parameter:

 

1) In the Object Navigator, select the Parameters node and choose

NAVIGATOR->CREATE.

 

2) Bring up the properties of the parameter and set the properties as needed.

   For example, Set the Datatype, Default Value, and Name of the parameter.

 

3) To access the value of the parameter, add the reserved word PARAMETER  as a prefix to the parameter name.  If you need to assign a value to a parameter, use a regular assignment statement such as:

 

   temp_test := :parameter.test;  -- assigns the value of the parameter to test

   :parameter.test := 'value';        -- assigns a value to the parameter test

 

 

 
 
Google
 
Web web site