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 04

"The true republic: men, their rights and nothing more: women, their rights and nothing less."

-Susan B. Anthony (1820-1906)

How can I pass parameters between FORMS?

 

Let’s suppose that you have two forms named EMPLOYEES and DEPARTMENTS. In the EMPLOYEES form, if your cursor is pointing at the “deptno” item when you click on a push button (“Show me department information…”) you would want it to open a window to display all information about that department.

 

Step 1:

Create the “DEPARTMENT” form as you create any other form.

Create a parameter and name it p_deptno. Open the parameter’s property palette and change the Parameter Data Type field to “Number,” the Maximum Length field to “2,” and the Parameter Initial Value field to “10.”

Open the data block properties (DEPT) and in the “WHERE Clause” property type deptno = :parameter.p_deptno

Create the “WHEN-NEW-FORM-INSTANCE” triggers on form level and type “execute_query;” then compile the procedure.

 

Step 2:

Create the “EMPLOYEES” form as you create any other form including the tabular, and 10 records at a time options, and check mark “Display Scrollbar” option.

Create a control block and then create a push button in that block. Open the push button’s property palette and change the “Name,” and “Label” fields. The “label” value should be “Show me department information…”

 

Create the “WHEN-BUTTON-PRESSED” trigger and type the following code:

DECLARE

p_id paramList; -- This is a variable that contains id of the parameter list

p_name VARCHAR2(20); -- A variable that keeps your parameter name

BEGIN

p_name := 'myparameter';

p_id := GET_PARAMETER_LIST('p_name'); -- find it if exists.

IF NOT ID_NULL (p_id) THEN

-- If exit then destroy it.

DESTROY_PARAMETER_LIST(p_id);

END IF;

--Now create a parameter list and add your p_deptno parameter.

p_id := CREATE_PARAMETER_LIST('p_name');

ADD_PARAMETER(p_id,'P_DEPTNO',TEXT_PARAMETER,to_char(:deptno));

--- You can call the called program either by default or specific like c:.

OPEN_FORM('c:',ACTIVATE,SESSION,p_id);

-- Error messages in case the called program was not able

-- to open called program.

IF NOT FORM_SUCCESS THEN

MESSAGE('ERROR: Unable to open the DEPARTMENT form.');

RAISE FORM_TRIGGER_FAILURE;

END IF;

EXCEPTION

WHEN others THEN

MESSAGE ('Error: unable to create parameter list…');

RAISE FORM_TRIGGER_FAILURE;

END;

 

Step 3:

Make sure that you have compiled the DEPARTMENT form.

 

Step 4:

Now, you should be able to test. Execute the query on the EMPLOYEES table and move your cursor to any record that you need to know more information about its department. Then click on the “Show me department information” push button. You should see complete information about that department.

 

 

 
 
Google
 
Web web site