Tutorial for Oracle10g Forms / Reports
In this lesson you will learn how to create an end-user interface and add more functionality to the basic form that we created in Lesson 1. Specifically, this will involve:
Creating
LOVs,
or List of Values, where you will connect your form to another table from which
the users make their selections
Creating
Radio Buttons
Creating
Combo Boxes and Poplists
Creating
Push Buttons
Adding
triggers to the Push Buttons for inserting, deleting and retrieving records
List
of Values (LOVs)
1. In this form we are designing, we will create
a List of Values for major, so that the user can select a major from the list.
To do this, first we will have to create table called Major_List.
2. To do this, go to SQL*Plus and type the
following code at the SQL prompt
SQL> CREATE TABLE MAJOR_LIST (MAJOR
VARCHAR2(20));
3. Now type in the following statement to
insert more data into the Major_list table:
SQL> INSERT INTO MAJOR_LIST VALUES ('Accounting');
SQL> INSERT INTO MAJOR_LIST VALUES ('Info. Systems');
SQL> INSERT INTO MAJOR_LIST VALUES ('Marketing');
SQL> INSERT INTO MAJOR_LIST VALUES ('Finance');
SQL> INSERT INTO MAJOR_LIST VALUES ('Decision Sciences');
SQL> COMMIT;
4. Now, type in Select * from Major_List; to
view your newly created table and its records.

5. Now, Open the Module you previously created
in Oracle Forms Builder. First, double click LOV in the Object Navigator on Forms
Builder, then select Use LOV Wizard.

6. Immediately, the window for LOV Wizard will
pop up, select Next, you will have the following screen:

7. Click Build SQL Query, then highlight
MAJOR_LIST table, click Include:

Close Select Data Tables
window, select MAJOR in Query Builder window:

Then, click OK. The
following SQL command created.

8. Click next, you will have the following
screen:

9. Select major and move it under LOV Columns,
then click next.

10. You will have the following screen:

11. Accept all default settings of LOV Wizard.
Click Look up return item and select STUDENT.MAJOR, then click OK.

Click next, you will have the following window, type in MAJOR_LOV
as title for your LOV:

Click Finish at this point,
you will come back to the Object navigator window. Now, name the LOV as
MAJOR_LOV by double clicking the icon under LOVs:

Which opens the following window,
change the LOV name to MAJOR_LOV, then close the Property Palette.

12. Now go back to the Canvas View by clicking
on the small picture icon just beneath the word Canvases in the Object
Navigator.

13. In the Canvas View, we will create a push
button and position it right beside the Major data field. To create the push
button, select the box like icon from the toolbox, click on it once and drop it
beside the Major data field.

14. After the push button has been created,
then right click on the button and select Property Palette from the list that
pops up.

15. Once you are in the Property Palette,
remove the label, specify Iconic as Yes and in the icon Filename type Down. Click on the close button in the lower taskbar located
on the upper right corner.

16. You will now return to Canvas View. Your
Canvas will now look like:

17. Now back in the canvas, right click on push
and this time select the PL/SQL Editor.



|
Declare |










And then change the fill pattern to blank.









|
begin select studid, studname, ftpt_status, sex, start_sem, start_year, major into :student.studid, :student.studname,
:student.ftpt_status, :student.sex, :student.start_sem,
:student.start_year, :student.major from student where studid = :student.studid; exception when no_data_found then message ('Invalid
Student Id:Please enter a valid raise form_trigger_failure; end; |

In a similar manner, create two other buttons,
totaling three push buttons.
|
Commit; |
|
Clear_Form; |

Lesson Summary
In this lesson, you have learned how to add various objects to your form and write triggers on them to add functionality. Specifically this involved:
1. Creating LOVs, or
List of Values, where you connected to another table from which users make
their selections
2. Creating Radio Buttons
3. Creating Poplists
4. Creating Push Buttons
5. Adding triggers to the push buttons for
inserting, clearing and retrieving records
In the next lesson we will create another push button for deleting records,
to which we will add alerts for warning the user before a record is deleted. We
will also use a procedure to create the above mentioned functionality. To learn
how to do this, proceed to Lesson 3.