measure of a man is how he treats someone who can do him
absolutely no good." - Samuel Johnson (1709-1784)
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 (For example: Show me department information") you
would want it to open a window to display all information about that
Before reading the
following hands-on exercise, you should have all ready completed at
least the "Introduction to Form Builder" hands-on. To avoid
repetition, we assume that, you are at least familiar with where the
icons and sub-menus are.
Create DEPARTMENT form
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. Then create the "WHEN-NEW-FORM-INSTANCE"
triggers on form level and type "execute_query;" then compile the
Create EMPLOYEES form
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"
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
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
p_name := 'myparameter';
GET_PARAMETER_LIST('p_name'); -- find it if exists.
IF NOT ID_NULL (p_id) THEN
-- If exit then destroy it.
--Now create a parameter
list and add your p_deptno parameter.
--- You can call the called
program either by default or specific like c:.
-- 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.');
WHEN others THEN
MESSAGE ('Error: unable to
create parameter list"');
Compile the DEPARTMENT form
Make sure that you have
compiled the DEPARTMENT form.
Test the application
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