FORMS:
- Form is the basic module created by Oracle Forms.
- Oracle Forms is a collection of many objects.
- The form itself has a set of properties which describes the behavior of a form.
Some of the form properties are title of the form and
which menu to use (File menu or DB menu)
DATABASE MODEL:
To build an application which is
efficient the underlying data base models should be constructed in a solid
manner. The underlying data base should be normalized first before building an
application on top of it.
DDL
Statements:
CREATE TABLE
contacts(
contact_id
NUMBER(9,0) NOT NULL,
last_name
VARCHAR2(20) NOT NULL,
zip_code
NUMBER(9,0),
first_name
VARCHAR2(20),
middle_name
VARCHAR2(20),
salutation VARCHAR2(10),
address_line_1
VARCHAR2(40),
address_line_2
VARCHAR2(40),
city
VARCHAR2(35),
state
VARCHAR2(2),
email_address
VARCHAR2(30));
CREATE TABLE
contact_phones (
contact_id
NUMBER(9,0) NOT NULL,
phone_number
VARCHAR2(20) NOT NULL,
phone_number_type
VARCHAR2(10) NOT NULL);
ALTER TABLE
contacts ADD CONSTRAINT contact_id_pk PRIMARY KEY(contact_id);
ALTER TABLE
contact_phones ADD CONSTRAINT contact_id_fk FOREIGN KEY(contact_id) REFERENCES
contacts(contact_id);
ALTER TABLE
contact_phones ADD CONSTRAINT contact_phone_number_type_ck CHECK
(phone_number_type IN ('FAX','HOME','WORK','PAGER','CELLULAR'));
Navigation/BUILDING A FORM IN FORM BUILDER:
Let’s
walk through the process of creating a form which is relatively simple. Let’s
create a form which is synonymous to our Address Book/Directory.
After
running the script it’s time to launch the Form Builder. Make sure that you
select ‘Build a new form manually’ and ‘Display at startup’
A
new module called “MODULE1” will be created automatically. We can change the
form name by selecting the MODULE1, and using tools->property
palette->Name and Title
The
first Step after renaming the module is to navigate to the data block and
select “table or view” as the data block.
To the right of this field is the button labeled Browse. On
click of this button will enable us to establish a connection with the data
base and select a table as a data block.
Drag the available column in the table to the data block items by
pressing the >> button.
Select create data block this will automatically take you to
layout wizard. Select the number of items to be displayed from the available
list.
If required change the prompt name, width and height of the
individual items in the data block.
The next option available is to set the Frame Title, the number
of records displayed and the space between the records.
This will create a layout and displays the layout structure in
the layout editor.
We can also change the alignment of various fields and format
the fields using the menus available in the layout editor.
Let us re-visit the object navigator once the layout is created.
In a similar manner let’s create a child data block in the
tabular form on the same canvas using the child table contact_phones.
Since the master child relationship exist at the database level
between contacts and contact_phones, the wizard will prompt you to create a
relationship between the data block.
The correct and exact relationships between the data block is
automatically retrieved from the database.
Once the relationship between block are created then wizard will
take us to the layout screen.
We can refrain from selecting the contact_id to the displayable
items as its very one purpose is to maintain a relationship with the parent
block.
This time a tabular form layout style should be selected as it
is best suited to portray the master child relationship.
Minimum of three phone details for a customer can be seen at a
time in our form
A master detail layout is created in the content canvas (CANVAS
2)
Let’s us change the
phone_number_type item from text item to list item using the property palette.
See the Phone number type field changed into a field with LOV in
the layout.
By Default on Populate Details and On Check Master Delete
triggers' will be created at the block level.
We are all set to compile the program.
COMPILING A FORM FROM UNIX:
Before compiling the form we need to ftp the form from the local
machine to the respective application top of the remote machine in the binary
mode.
For e.g.
Local Machine->CONTACT.fmb AAR_TOP/Forms/US/CONTACTS.fmb
In 11i Environment:
f60gen
module=<module_name.fmb> userid=USERID/PASSWORD
output_file=<output_file_name.fmx> compile_all=yes
f60gen module=CONTACTS.fmb
userid=USERID/PASSWORD output_file=CONTACTS.fmx compile_all=yes
In R12 Environment:
Frmcmp_batch module=<module_name.fmb>
userid=USERID/PASSWORD output_file=<output_file_name.fmx> compile_all=yes
Frmcmp_batch module=CONTACTS.fmb
userid=USERID/PASSWORD output_file=CONTACTS.fmx compile_all=yes
If the compilation is successful then the .fmx file will be
created in the intended/specified location.
REGISTERING A FORM IN ORACLE APPLICATION:
Navigate to application developer responsibility and open the
form function.
Specify the module name in the form field and appropriate
application name which is under your responsibility. The user form name should
be meaningful and if needed description can be provided. Text in the required
application name as required. I have removed the application name in below
screen shots for security purpose.
In the Application Developer-> Function register the form to
a particular function.
To register the function to a particular menu you should be
aware of the menu which is defined for the responsibility. So navigate to
System Administrator->Responsibility->Define and query for the desired
responsibility. Find the User Menu name for the responsibility and then add the
function details to the appropriate menu.
Add our function Contact Detail to the menu derived from the
responsibility.
Once the function is added to the menu a request will be sent
automatically to recompile the menu group. Now the newly added form is visible
under the particular responsibility, under the particular menu and under the
particular function.
No comments:
Post a Comment