Oracle 9i Forms Developer Quick Notes
Oracle 9i Forms Developer Quick Notes
Oracle 9i Forms Developer Quick Notes
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
• CONTENTS
TOPIC PAGE
Installing Oracle Developer Suite ……………………………………………... 1.1
Oracle Forms Builder……………………………………………………………. 1.2
Creating Non Database Items (Application Items) ………………………….. 2.1
(A) Summary
(B) Formula
Master-Detail ……………………………………………………………………. 2.2
Visual-Attributes ………………………………………………………………… 2.2
List of Values LOV ……………………………………………………………… 2.3
(A) Manually
(B) Using LOV Wizard
Editors ……………………………………………………………………………. 2.3
Triggers …………………………………………………………………………… 3.1
Check Box Display Item …………………………………………………………. 3.3
LOV Display Item ………………………………………………………………… 3.4
(A) Push Buttons
(B) Display Items
Types of Canvas …………………………………………………………………. 4.1
(B) Stacked Canvas
(C) Horizontal & Vertical Toolbars
(D) Tab Canvas
Database List …………………………………………………………………….. 4.2
Assembled Task …………………………………………………………………. 5.1
Tree ………………………………………………………………………………... 6.1
Alert ………………………………………………………………………………... 6.2
Multiple Form Activation ………………………………………………………… 6.2
Important Task …………………………………………………………………… 6.3
Solution of the Important Task ………………………………………………….. 6.4
Parameter List ……………………………………………………………………. 7.1
Program Units ……………………………………………………………………. 7.2
Debug Mode ……………………………………………………………………… 7.2
Object Groups ……………………………………………………………………. 8.1
Object Libraries …………………………………………………………………... 8.1
PL/SQL Libraries …………………………………………………………………. 8.1
Menus ……………………………………………………………………………... 8.2
Template Forms ………………………………………………………………….. 8.2
Logon Forms ……………………………………………………………………… 9.1
WebUtil ……………………………………………………………………………. 9.2
Uploading BLOB Image …………………………………………………………. 10.1
Iconic Buttons …………………………………………………………………….. 10.1
Opening Forms in a separate window …………………………………………. 10.1
Installing Java Beans ……………………………………………………………. 10.2
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
1‐1
• If a problem occurs with your Database:
Start Æ Oracle – OraDb10g_home Æ Configuration & Migration Tools
Æ Database Configuration Assistant Æ Database Configuration Assistant
Æ Delete a Database
• Changing language:
Run Æ Regedit Æ HKEY_LOCAL_MACHINE Æ SOFTWARE Æ ORACLE
Find: NLS_LANG Æ Modify
Æ Value data: AMERICAN_AMERICA.AR8MSWIN1256
• Note: Create a folder in the root directory, i.e. Path without any spaces to store your
forms. Copy this path and paste it into the following file:
[C]:\DevSuiteHome\Forms\Server\default.env (Open using Notepad and beside
FORMS_PATH=[C]:\DevSuiteHome_1\forms; [HERE])
Note: You can also connect by clicking on the connect icon in the tools bar or by clicking
Ctrl+j.
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
1‐2
(4) Creating Tabular (Table Shaped Form):
Forms
Module1
Data Blocks (Use the Data Block Wizard) Æ Table or View
(6) Each form you create will be saved under 2 different file extensions:
.fmb: Modifiable files Extension
.fmx: Executable files Extension
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
2‐1
• To create a non-database item (Application Item):
(A) SUMMARY
(B) FORMULA
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
2‐2
• MASTER-DETAIL:
• VISUAL ATTRIBUTES:
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
2‐3
• LIST OF VALUES ‘LOVs’:
(A) MANUALLY
Note: If you want to hide a column in your form, choose its width to be ‘0’
Note: Using LOV Wizard, the list of values of the return column is updated
automatically.
¾ TASK: Location from Locations, Form Employees [Mgrs, Depts]
• EDITORS:
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
3‐1
• TRIGGERS
TYPE CODE
SCOPE
Trigger Type: Defines the specific event that will cause the trigger to fire.
Trigger Code: The body of PL/SQL that defines the actions of the trigger.
Trigger Scope: The level in a form module at which the trigger is defined.
• Trigger Type:
Î Pre-
Î Post-
Î When-
Î On-
Î Key-
Î User-named
¾ TASK: Block Level, Record Level, Item Level (Apply it on Button WHEN-BUTTON-
PRESSED) Triggers
• Repeat the same steps as the previous Form Level Trigger.
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
Notes: 3‐2
(1) HELP Æ Ctrl+H
(2) Don’t forget that each item in the Form is a Bind Variable, so you have to use (:)
Ex. If you want to display a dynamic message:
MESSAGE (‘Welcome to Employees’ || : Employees.Last_Name)
(3) There are some Triggers that are no longer used in 10g but you may find them in HELP
to serve for backward compatibility.
(4) Advice: Try to put objects which are not related to tables or items in a separate Data
Block (Ex. Control).
(5) We wrote the Message 2 times in the PL/SQL Block, because the 1st time it appears in
Consol and the 2nd time it is displayed for the user in the Form.
BEGIN BEGIN
FOR i IN FOR i IN 0..9 LOOP
1..LENGTH(:Last_Name) LOOP IF INSTR (:LAST_NAME,i) > 0
IF SUBSTR (:LAST_NAME,i,1) THEN
IN ('0','1','2','3','4','5','6','7','8','9') MESSAGE ('YOU CANNOT
THEN ENTER A NAME INCLUDING
MESSAGE ('YOU CANNOT NUMBERS');
ENTER A NAME INCLUDING MESSAGE ('YOU CANNOT
NUMBERS'); ENTER A NAME INCLUDING
MESSAGE ('YOU CANNOT NUMBERS');
ENTER A NAME INCLUDING RAISE
NUMBERS'); FORM_TRIGGER_FAILURE;
RAISE END IF;
FORM_TRIGGER_FAILURE; END LOOP;
END IF; END;
END LOOP;
END;
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
3‐3
¾ TASK: Create a WHEN-VALIDATE-ITEM Trigger on EMAIL
(1) Create Form (Employees)
(2) Create Smart Triggers Æ WHEN-VALIDATE-ITEM
(3) PL/SQL Code:
BEGIN
IF (:EMAIL) LIKE '%@%.%'
THEN
-- Checks How many Letters after the Dot
IF LENGTH (SUBSTR (:EMAIL,INSTR(:EMAIL,'.'))) > 4
THEN
MESSAGE ('CHECK THE NUMBER OF LETTERS AFTER THE DOT');
MESSAGE ('CHECK THE NUMBER OF LETTERS AFTER THE DOT');
RAISE FORM_TRIGGER_FAILURE;
-- Checks if the EMAIL starts with @
ELSIF (: EMAIL) LIKE ‘@%'
Or (: EMAIL) LIKE '%@'
THEN
MESSAGE ('@ SYMBOL IS NOT IN ITS APPROPRIATE PLACE');
MESSAGE ('@ SYMBOL IS NOT IN ITS APPROPRIATE PLACE');
RAISE FORM_TRIGGER_FAILURE;
END IF;
ELSE
MESSAGE ('THIS IS AN APPROPRIATE EMAIL FORMAT');
MESSAGE ('THIS IS AN APPROPRIATE EMAIL FORMAT');
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;
• CHECKBOX_DISPLAY_ITEM
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
END IF;
END; 3‐4
• LOV_DISPLAY_ITEM
(A) Push-Buttons
DECLARE DECLARE
V_LOV_DEPT BOOLEAN; V_LOV_MGR BOOLEAN;
BEGIN BEGIN
V_LOV_DEPT:=SHOW_LOV('LOV_DEPT'); V_LOV_MGR:=SHOW_LOV('LOV_MGR');
END; END;
Note:
V_LOV_DEPT, V_LOV_MGR are the names of Push-Buttons
LOV_DEPT, LOV_MGR are the names of LOVs
(B) Display-Items
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
4‐1
• Types of Canvas:
(A) Content
(B) Stacked
(C) Toolbar
(D) Tab
Example:
(1) Create a Form - Content Canvas (Departments)
(2) Create a Button for Manager_id
(3) Create a new Data Block (Employees) – No Relations,
New Canvas – Type: Stacked
(4) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
BEGIN
--Use One_Time_Where Function to Set_Block_Property
SET_BLOCK_PROPERTY ('EMPLOYEES',ONETIME_WHERE,
‘EMPLOYEE_ID=:DEPARTMENTS.MANAGER_ID');
GO_BLOCK('EMPLOYEES');
EXECUTE_QUERY;
--Use Show_View Function to view the Stacked Canvas
SHOW_VIEW ('STACKED');
END;
(5) Create a Button to exit the Employees Canvas
(6) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
BEGIN
GO_BLOCK('DEPARTMENTS');
HIDE_VIEW('STACKED');
END;
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
4‐2
Example:
(1) Create a new Form (Employees) – Canvas Type: Content
(2) Create a new Canvas from Object Navigator Æ F4 - Canvas Type: Tab
(3) Notice that as soon as you create a Tab Canvas, Tab pages are displayed
(4) Modify in the Tab Pages [Add, Select items to be displayed, etc…]
(5) For each item in the Content Canvas Æ F4 and choose its Canvas and tab
page
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
5‐1
DEPARTMENTS
EMPLOYEES
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
6‐1
• TREE:
A Unique Data Block has to be created for the Tree
(1) Create a new Form [TREE]
(2) Create a Data Block manually [TREE_BLOCK]
(3) From Layout View, Create a Hierarchical Tree [MY_TREE]
(4) Create a Record Group [RG_TREE]
Select 1, Level, Last_Name, Null, To_char (Employee_id) ID From Employees
Connect by prior Employee_id = Manager_id
Start with Manager_id is Null
Mode of TREE:
-1: Collapsed 0: Level 1 1: Expanded
Pseudo-Column:
Level (May also take values 1, 2, 3,..)
The Column that appears to the user:
Last_Name
Instead of putting icons:
Null
The value in Database MUST be of the same data type as the Column that
appears to the user [Last_Name]:
Employee_id
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
END;
6‐2
• ALERT:
(1) Create a new Form [ALERT]
(2) Create a Data Block [DEPARTMENTS] – Tabular
(3) Create Alert from Object Navigator [MY_ALERT]
ÆF4
Title: [Display a title]
Message: [Display your Message]
Alert Style: [Choose your style]
Button Label: [Choose Label]
Default Alert Button: [Choose your default Button]
(4) Create a WHEN-WINDOW-CLOSED Trigger on Form Level
PL/SQL Code:
DECLARE
V_ALERT NUMBER;
BEGIN
V_ALERT:=SHOW_ALERT('MY_ALERT');
IF V_ALERT=ALERT_BUTTON1
THEN
EXIT_FORM(DO_COMMIT);
ELSIF
V_ALERT=ALERT_BUTTON2
THEN
EXIT_FORM(NO_COMMIT);
GO_BLOCK('DEPARTMENTS');
END IF;
END;
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
6‐3
Example:
(1) Create a new Form (Employees)
(2) Create another Form (Calling_Departments) – Data Block (Departments)
(3) Create a Button (B_Call_Dept) on Employees Form
(4) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
BEGIN
:GLOBAL.DEPT_ID:=:EMPLOYEES.DEPARTMENT_ID;
IF ID_NULL(FIND_FORM('CALLING_DEPARTMENTS'))
THEN
OPEN_FORM('CALLING_DEPARTMENTS');
ELSE
GO_FORM ('CALLING_DEPARTMENTS');
END IF;
END;
(5) Create a WHEN-NEW-FORM-INSTANCE Trigger on Calling_Departments
Form
PL/SQL Code:
BEGIN
SET_BLOCK_PROPERTY('DEPARTMENTS',ONETIME_WHERE,'DEP
ARTMENT_ID='||:GLOBAL.DEPT_ID);
GO_BLOCK('DEPARTMENTS');
EXECUTE_QUERY;
END;
Note:
Don’t forget to save the 2 Forms, so that you can use their File_Names in
the code.
We use Global Variables to open a Form from another Form.
¾ Task: [V.I.P]
(1) Create a Table [Forms] (Form_Name Primary_Key, Module_Name,
Parent_Form Foreign_Key, Description)
(2) Create a TREE (Description Appears & takes its value from
Form_Name in Database)
Hint:
Select 1, Level, Description, Null, Form_Name From Forms
Connect by prior Form_Name =Parent _Form
Start with Parent_Form is Null
(3) Create a Form as Follows:
TREE Form_Name
Module_Name
Parent_Form LOV
Description
Prepared by: Eng. Héba M. Noweir Refresh
Oracle Forms Developer 10g: Build Internet Applications
6‐4
• Task [V.I.P] Solution:
(1) Create Table Forms (Form_name varchar2(50) primary key,
module_name varchar2(50), parent_form varchar2(50), description varchar2(200), constraint
FK_Form_parent foreign key (parent_form) references forms (form_name));
(2) Create a new Form (FORMS_TREE) – Datablock: (Forms)
(3) Create a new Datablock manually: (Tree)
(4) From Layout View, create a Hierarchical tree (MY_TREE)
(5) Create a Record Group (RG_TREE)
SELECT 1, Level, DESCRIPTION, NULL, FORM_NAME FROM FORMS CONNECT BY
PRIOR FORM_NAME=PARENT_FORM START WITH PARENT_FORM IS NULL;
F4 on MY_TREE Æ Choose RG_TREE
(6) Create a LOV Button (B_LOV) beside Parent_Form
Create Record Group (RG_FORMS)
SELECT DESCRIPTION, FORM_NAME FROM FORMS
Create LOV using LOV Wizard based on the existing Record Group (RG_FORMS),
LOV Column: Form_Name, Return Value: FORMS.PARENT_FORM
Create a When-Button-Pressed Trigger on B_LOV
PL/SQL Code:
DECLARE
V_LOV BOOLEAN;
BEGIN
V_LOV:=SHOW_LOV('LOV_PARENT');
END;
(7) Create a Button (B_Refresh), Keyboard Navigable: No, Mouse Navigable: No
Create a When-Button-Pressed Trigger
PL/SQL Code:
DECLARE
V_RG_TREE NUMBER;
BEGIN
COMMIT_FORM;
V_RG_TREE:=POPULATE_GROUP('RG_TREE');
FTREE.POPULATE_TREE('MY_TREE');
END;
(8) Create a When-New-Form-Instance Trigger
PL/SQL Code:
DECLARE
V_RG_TREE NUMBER;
BEGIN
V_RG_TREE:=POPULATE_GROUP('RG_TREE');
FTREE.POPULATE_TREE('MY_TREE');
END;
(9) Create a When-Tree-Node-Activated Trigger
PL/SQL Code:
DECLARE
V_NODE_VALUE VARCHAR2(50);
BEGIN
V_NODE_VALUE:=FTREE.GET_TREE_NODE_PROPERTY('MY_TREE',:SYSTEM.TRIG
GER_NODE, FTREE.NODE_VALUE);
OPEN_FORM('V_NODE_VALUE');
END;
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
7‐1
• PARAMETER LIST:
(1) Create a new Form (PAR_EMP) – Data Block (Employees)
(2) Create another Form (PAR_DEPT) – Data Block (Departments)
(3) Create a Button on Employees Block beside Department_id to Call the
PAR_DEPT Form
(4) Create Parameter on PAR_DEPT [P_DEPT] From Object Navigator
F4 Æ Parameter Data Type: Number
(5) Save both Forms
(6) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
DECLARE
PL_ID PARAMLIST;
PL_NAME VARCHAR2(10) :='TEMP';
BEGIN
PL_ID:=GET_PARAMETER_LIST(PL_NAME);
--IF THE PARAMETER LIST DOESN'T EXIST THEN CREATE A NEW
ONE
IF ID_NULL(PL_ID) THEN
PL_ID:=CREATE_PARAMETER_LIST(PL_NAME);
--IF THE PARAMETER LIST ALREADY EXISTS THEN DELETE THE
PARAMETERS FROM IT
ELSE
DELETE_PARAMETER(PL_ID,'P_DEPT');
END IF;
--ADD P_DEPT PARAMETER TO PARAMETER LIST
ADD_PARAMETER(PL_ID,'P_DEPT',TEXT_PARAMETER,:EMPLOYEE
S.DEPARTMENT_ID);
--OPEN THE FORM
OPEN_FORM('PAR_DEPT',ACTIVATE,NO_SESSION,PL_ID);
END;
(7) Create a WHEN-NEW-FORM-INSTANCE Trigger on PAR_DEPT Form
PL/SQL Code:
BEGIN
IF :PARAMETER.P_DEPT IS NOT NULL
THEN
SET_BLOCK_PROPERTY
('DEPARTMENTS',ONETIME_WHERE,'DEPARTMENT_ID='||:PARAMETER.P
_DEPT);
GO_BLOCK('DEPARTMENTS');
EXECUTE_QUERY;
END IF;
END;
(8) Save both Forms Æ RUN
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
7‐2
• PROGRAM UNITS:
(1) Create a new Form [PROGRAM_UNITS] – Data Block (Employees)
(2) Create a Program Unit from Object Navigator
Æ Procedure: Raise_Salary
PL/SQL Code:
PROCEDURE RAISE_SALARY (EMP_ID NUMBER) IS
BEGIN
UPDATE EMPLOYEES
SET SALARY=SALARY+1000
WHERE EMPLOYEE_ID=EMP_ID;
END;
(3) Create a Button beside Salary on the Form
(4) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
BEGIN
RAISE_SALARY (:EMPLOYEE_ID);
END;
• DEBUG MODE:
(1) Create a new Form [DEBUG_MODE] – Data Block (Employees)
(2) Create a Button beside Salary
(3) Create a WHEN-BUTTON-PRESSED Trigger
PL/SQL Code:
BEGIN
--I WANT TO INCREASE THE SALARY OF THE CURRENT
EMPLOYEE
• SELECT SALARY+1000 INTO :SALARY
FROM EMPLOYEES WHERE EMPLOYEE_ID=:EMPLOYEE_ID;
/*
I WANT TO MAKE THE MANAGER OF THIS EMPLOYEE HIS
MANAGER'S MANAGER
TO MAKE THE EMPLOYEE AND HIS DIRECT MANAGER ON THE
SAME LEVEL
AN ERROR WILL OCCUR WHEN THE MANAGER_ID OF THE
MANAGER IS NULL,
SO WE NEED TO DEBUG THE FORM
*/
• SELECT MANAGER_ID INTO :MANAGER_ID
FROM EMPLOYEES WHERE EMPLOYEE_ID=:MANAGER_ID;
COMMIT_FORM;
END;
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
Note: 7‐3
The above code would probably cause a BUG
F5 (Insert/Remove Breakpoint )
RUN from Debug
Pause
Step into/Step out [Trace the Program]
After detecting the BUG, we can handle it
Example:
EXCEPTION
WHEN NO_DATA_FOUND THEN MESSAGE('THIS MANAGER HAS
NO MANAGERS');
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
8‐1
• OBJECT GROUPS:
Illustrative Example:
(1) Create a new Form [DEPT_OG] – Data Block (Departments)
(2) Create an Alert
(3) Create a When-New-Form-Instance
BEGIN
SET_WINDOW_PROPERTY
('WINDOW1',WINDOW_STATE,'MAXIMIZE');
END;
(4) Create a LOV for Locations
(5) From the Object Navigator, Create an Object Group
(6) Drag and Drop all what we have previously created [Window, Canvas, Trigger,
Alert, LOV] into Object Group
(7) Create a new form
(8) Drag and Drop the Object Group of the 1st Form into this new Form
Note:
Subclass: If you change in the parent Object Group, all children will be changed
• OBJECT LIBRARIES:
(1) Create Object Library from Object Navigator MUST be saved
(2) You can Drag & Drop any Object into Object Library
• PL/SQL LIBRARIES:
Illustrative Example:
(1) Create a PL/SQL Library from Object Navigator and save it under any name
(2) Create Program Units Æ Procedure [PROC_COMMIT]
PROCEDURE PROC_COMMIT IS
BEGIN
COMMIT_FORM;
END;
(3) Compile & Save
(4) Create a new Library Æ Program Units Æ Procedure [PROC_2]
PROCEDURE PROC_2 IS
BEGIN
PROC_COMMIT;
END;
(5) Attach the 1st Library because the new one depends on it
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
8‐2
• MENUS:
(1) Create Menu from Object Navigator
(2) Create Items
(3) Investigate the Property Palette and Use the Help to find codes
¾ TASK:
Create a Menu like Oracle Forms Menu
• TEMPLATE FORMS:
Illustrative Example:
(1) Create a new Form
(2) Create a new Data Block [CONTROL] manually on a Horizontal Toolbar Canvas
(3) Add the Following Buttons:
PL/SQL Code:
a. Create_record; Æ ADD
b. Delete_record; Æ DELETE
c. Commit_form; Æ SAVE
d. First_record; Æ FIRST
e. Previous_record; Æ PREVIOUS
f. Next_record; Æ NEXT
g. Last_record; Æ LAST
h. Enter_query; Æ ENTER
i. Execute_query; Æ EXECUTE
j. Clear_block; Æ CLEAR
k. Exit_form; Æ EXIT
Note:
Investigate F4 Æ Tooltip
(4) Create a Form Level Trigger (When-New-Form-Instance)
PL/SQL Code:
BEGIN
SET_WINDOW_PROPERTY('WINDOW1',WINDOW_STATE,MAXIMIZE);
END;
(5) Create an Alert
(6) Form Æ F4 Æ Menu Module [Choose the one you created in the last exercise]
(7) Save this Template Form
(8) Create an Object Group [OG_TEMPLATE] and Add everything you created in
the previous steps
(9) Create a new Form [BASED_ON_TEMPLATE] – Data Block (Departments)
(10) Drag & Drop Object Group
(11)SET_WINDOW_PROPERTY('WINDOW_NAME',TITLE,:SYSTEM.CURRENT_F
ORM);
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
• LOGON FORMS:
(1) In iSQLplus Environment, Create the following table: 9‐1
Create Table USERS
(USER_NAME VARCHAR2(20) PRIMARY KEY,
NAME VARCHAR2(100),
PASSWORD VARCHAR2(30),
SECURITY_LEVEL VARCHAR2(1));
(2) Create a new Form [USERS_TAB] – Data Block (USERS)
(3) Security_Level: Static List_item
Level A Æ A
Level B Æ B
Level C Æ C
(4) Password: Conceal Data
(5) Create a new Data Block (Control) manually on a new Canvas
(6) Create 2 Text Items (Non Database Items):
Username U_USER Password U_PASS
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
9‐2
• WEBUTIL:
- WebUtil is a free extensible utility that enables you to interact with the client
machine
- Although WebUtil uses Java classes, you code in PL/SQL
- You integrate WebUtil into a form by attaching its PL/SQL library and using an
object group from its object library; then you can use its functions after the form
has started and while it is running
- With WebUtil, you can do the following on the client machine: open a file dialog
box, read and write image or text files, execute operating system commands,
perform OLE automation, and obtain information about the client machine
- To install WebUtil, Follow the instruction of the word file downloaded from the
Internet
¾ TASK:
(1) Create Form – Data Block (Control) manually
(2) Create an image in the Canvas F4 Æ Data Base Item: No
(3) Create Button [B_image] – When-Button-Pressed-Trigger
PL/SQL Code:
DECLARE
V_FILE VARCHAR2(500):= CLIENT GET_FILE_NAME('','','GIF FILES|
*.GIF|JPEG FILES|*.JPG|ALL FILES|*.*','SELECT IMAGE TO
UPLOADED',OPEN_FILE,TRUE);
V_IMAGE ITEM:=FIND_ITEM('EMPS.IMAGE');
BEGIN
CLIENT_IMAGE.READ_IMAGE_FILE(V_FILE_NAME,'',V_IMAGE);
END;
(4) Image Æ F4
Sizing Style: Adjust
Data Base Item: No
Mouse Navigate: No
Keyboard Navigate: No
Prepared by: Eng. Héba M. Noweir
Oracle Forms Developer 10g: Build Internet Applications
10‐1
• UPLOADING BLOB IMAGE:
(1) Create Table Emps as select employee_id, last_name from employees where
department_id=30;
(2) Alter Table Emps add (image BLOB) [I am supposed to fill this table with
images]
(3) Forms Builder:
a. Create Form – Data Block (Emps)
b. Upload-image-to-table
c. Drag & Drop Object Group from Object Library
d. Attach PL/SQL Library (WebUtil.pll) – SubClass WebUtil.olb
e. Canvas of WebUtil [Invisible]
(4) Create Button [B_image] – When-Button-Pressed-Trigger
PL/SQL Code:
DECLARE
V_FILE VARCHAR2(500):= CLIENT GET_FILE_NAME('','','GIF FILES|
*.GIF|JPEG FILES|*.JPG|ALL FILES|*.*','SELECT IMAGE TO
UPLOADED',OPEN_FILE,TRUE);
V_IMAGE ITEM:=FIND_ITEM('EMPS.IMAGE');
BEGIN
CLIENT_IMAGE.READ_IMAGE_FILE(V_FILE_NAME,'',V_IMAGE);
END;
(5) Image Æ F4
Sizing Style: Adjust
Data Base Item: No
Mouse Navigate: No
Keyboard Navigate: No
• ICONIC BUTTONS:
(1) Edit Oracle_DevSuiteHome/Forms/Server/formsweb.cfg
[imageBase=CodeBase] ‘This step is done once’
(2) Put the gif files you want to use in your Forms in
Oracle_DevSuiteHome/Forms/Java
(3) Create a button on a canvas
F4 Æ Iconic: Yes
Icon Filename: [simply write the name of the file without extensions]
10‐2
• INSTALLING JAVA BEANS:
Prepared by: Eng. Héba M. Noweir