Professional Documents
Culture Documents
Forms Developer-Build Internet Applications II 1.1
Forms Developer-Build Internet Applications II 1.1
.......................................................................................
40034GC11
Production 1.1
June 2001
DXXXXX
Author Copyright Oracle Corporation, 2001. All rights reserved.
Pam Gamer If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with Restricted Rights, as defined in
Pascal Gibert
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Thierry Guibert
The information in this document is subject to change without notice. If you find
Ellen Gravina any problems in the documentation, please report them in writing to Education
Norris Gray Products, Oracle Corporation, 500 Oracle Parkway, Box 659806, Redwood
Anthony Hargreaves Shores, CA 94065. Oracle Corporation does not warrant that this document is
error-free.
Ali Hiemstra
Oracle Developer, Oracle Server, and PL/SQL are trademarks or registered
Barry Hiern
trademarks of Oracle Corporation.
Ursula Hovy
All other products or company names are used for identification purposes only,
Sarah Jones and may be trademarks of their respective owners.
Jan Keuben
Aija Lehtonen
Regis Louis
Kenji Makita
Jayne Marlow
Sergei Pechersky
Milos Randak
Jonas Reborg
Bryan Roberts
Candace Stover
Hiroyuki Sugiyama
Laura Tejero
Jack Walsh
Publisher
Shane Mattimoe
Contents
.....................................................................................................................................................
Contents
Preface
Profile xv
Related Publications xvi
Typographic Conventions xvii
Introduction
Introduction I-2
Course Content I-3
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II iii
Contents
.....................................................................................................................................................
.....................................................................................................................................................
iv Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II v
Contents
.....................................................................................................................................................
.....................................................................................................................................................
vi Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II vii
Contents
.....................................................................................................................................................
.....................................................................................................................................................
viii Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II ix
Contents
.....................................................................................................................................................
.....................................................................................................................................................
x Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II xi
Contents
.....................................................................................................................................................
.....................................................................................................................................................
xii Oracle iDS Forms: Build Internet Applications II
Preface
.................................
Preface
.....................................................................................................................................................
Notes Page
.....................................................................................................................................................
xiv Oracle iDS Forms: Build Internet Applications II
Profile
.....................................................................................................................................................
Profile
Before You Begin This Course
Before you begin this course, you should have the following qualifications:
Thorough knowledge of:
- Creating simple applications with Oracle Forms Developer Form
Builder
- Creating SQL query statements
Working experience of:
- Creating PL/SQL constructs, including conditional statements,
procedures, and functions
- Creating PL/SQL stored (server) procedures and functions
Knowledge of using a graphical user interface (GUI)
Knowledge of using a Web browser, and downloading HTML pages
with a Uniform Resource Locator (URL)
Prerequisites
The following instructor-led training (ILT) course: Oracle 9iDS Forms:
Build Internet Applications I
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II xv
Preface
.....................................................................................................................................................
Related Publications
Oracle Publications
Title Part Number
Oracle Forms Developer and Oracle Reports Developer Guide- A73073-02
lines for Building Applications, Release 6i
Oracle Forms Developer Getting Started, Release 6i A73154-01
Oracle Forms Server Release 6i Patch 2: Deploying Forms Appli- A86202-01
cations to the Web with the Oracle Internet Application Server
Additional Publications
read.me file
relnotes.pdf file
.....................................................................................................................................................
xvi Oracle iDS Forms: Build Internet Applications II
Typographic Conventions
.....................................................................................................................................................
Typographic Conventions
Typographic Conventions in Text
Convention Element Example
Bold italic Glossary term (if The algorithm inserts the new key.
there is a glossary)
Caps and lowercase Buttons, Click the Executable button.
check boxes, Select the Cant Delete Card check box.
triggers,
Assign a When-Validate-Item trigger . . .
windows
Open the Master Schedule window.
Courier new, Code output, Code output: debug.seti(I,300);
case sensitive directory names, Directory: bin (DOS), $FMHOME (UNIX)
(default is filenames,
Filename: Locate the init.ora file.
lowercase) passwords,
pathnames, Password: Use tiger as your password.
URLs, Pathname: Open c:\my_docs\projects
user input, URL: Go to http://www.oracle.com
usernames User input: Enter 300
Username: Log on as scott
Initial cap Graphics labels Customer address (but Oracle Payables)
(unless the term is a
proper noun)
Italic Emphasized words Do not save changes to the database.
and phrases, For further information, see Oracle7 Server
titles of books SQL Language Reference Manual.
and courses,
Enter user_id@us.oracle.com, where
variables
user_id is the name of the user.
Quotation marks Interface elements Select Include a reusable module
with long names component and click Finish.
that have only This subject is covered in Unit II, Lesson 3,
initial caps; lesson Working with Objects.
and chapter titles in
cross-references
Uppercase SQL column Use the SELECT command to view
names, commands, information stored in the LAST_NAME
functions, schemas, column of the EMP table.
table names
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II xvii
Preface
.....................................................................................................................................................
.....................................................................................................................................................
xviii Oracle iDS Forms: Build Internet Applications II
................................
Introduction
Lesson I:
......................................................................................................................................................
Introduction
Aim of the Course
After completing this course, you should be able to do the following:
Create, modify and attach menu documents to Oracle Forms
Developer Internet applications
Ensure application security with Oracle8i database roles
Code triggers that respond to function keys
Respond to mouse movement and mouse button actions
Manipulate windows and canvases
Choose appropriate data sources for data blocks
Work with Oracle8i objects in Form Builder
Create and manage multiple Internet form applications
Manage transaction processing in multiple Oracle Forms
Developer Internet applications
Create and modify Record Groups programmatically
Build forms with Reusable Components
Enhance the User Interface with JavaBeans
Manage Server side features
Create Timers
Include charts and reports in Oracle Forms Developer
Internet applications
......................................................................................................................................................
I-2 Oracle iDS Forms: Build Internet Applications II
Course Content
......................................................................................................................................................
Course Content
The lesson titles show the topics we cover in this course, and the usual
sequence of lessons. However, the daily schedule is an estimate, and may
vary for each class.
Day 1
Lesson
Number Lesson Name
1 Creating a Menu Module
2 Managing Menu Modules
3 Programming Function Keys
4 Responding to Mouse Events
Day 2
Lesson
Number Lesson Name
5 Controlling Windows and Canvases
Programmatically
6 Defining Data Sources
7 Working with Oracle8i Objects in Form Builder
8 Controlling Data Block Relationships
9 Building Multiple Form Applications
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II I-3
Lesson I:
......................................................................................................................................................
Day 3
Lesson
Number Lesson Name
10 Working with Record Groups
11 Using Reusable Components
12 Using Java with Web-Deployed Forms
13 Using Server Features in Form Builder
14 Applying Timers
15 Including Charts and Reports
......................................................................................................................................................
I-4 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
1-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
By default, each form module uses the same menu structure, called the Default menu.
This lesson teaches you how to customize this menu and how to create your own menu
modules. You will also learn how to enhance your application by including menu
toolbars and pop-up menus.
Objectives
After completing this lesson, you should be able to do the following:
Identify the different components of a menu module
Create, save, and attach menu modules
Set menu properties by using the Property Palette
Create menu toolbars
Create pop-up menus
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-3
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Menu
module
Menu
Submenu
items
Menu
items
......................................................................................................................................................
1-4 Oracle iDS Forms: Build Internet Applications II
Components of the Menu Module
......................................................................................................................................................
What Is a Menu?
A menu is a list of related options. Each option performs a different action. You can
create three menu types in Forms:
Main menu:
- Displays horizontally in the menu bar
- Contains options (menu items) that are typically individual menus
Individual menu: Displays vertically
Submenu: Displays vertically and to the right of the menu item that
calls it
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-5
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Default Menu
......................................................................................................................................................
1-6 Oracle iDS Forms: Build Internet Applications II
The Default Menu
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-7
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Technical Note
By default, the Menu Editor displays a pull-down menu, with the
top-level menu displayed horizontally. If you are developing a full-screen menu, you
may want to display the top-level menu vertically, so that the display matches the way
your menu will appear at run time. To change the orientation, click the Switch
Orientation button.
......................................................................................................................................................
1-8 Oracle iDS Forms: Build Internet Applications II
The Menu Editor
......................................................................................................................................................
Tool Function
Display Determines the highest level menu that the Menu Editor displays. (Choose
Menu from all the menus in your menu module.)
Create Down Creates a new menu item below the currently active one
Create Right Creates a new menu item to the right of the currently active one
Switch Allows display of the top-level menu vertically or horizontally
Orientation
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-9
Lesson 1: Creating a Menu Module
......................................................................................................................................................
......................................................................................................................................................
1-10 Oracle iDS Forms: Build Internet Applications II
Creating a Menu Module
......................................................................................................................................................
Creating a Submenu
1 Select the parent item on the individual menu.
2 Click the Create Right icon.
3 Replace the default label.
4 Select Menu>Create Down to add another item to the submenu.
5 Replace the default label.
6 Repeat steps 4 and 5 to add more submenu items.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-11
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Main Menu
Menu Directory
Menu Filename
Startup Code
Share Library with Form
Use Security
Module Roles
......................................................................................................................................................
1-12 Oracle iDS Forms: Build Internet Applications II
Module Properties
......................................................................................................................................................
Module Properties
Property Description
Main Menu Property that specifies the name of the individual menu in the module
that is the main or starting menu at run time
For a pull-down menu, the main menu is automatically set to the name
of the first menu that you create. Users cannot navigate above this
menu in the menu hierarchy.
Menu Directory Path used by Forms as a pointer to the directory for the run-time .mmx
file; only used by menu modules that are saved to the database
Menu Filename Filename used by Forms as a pointer to the run-time .mmx file; only
used by menu modules that are saved to the database
Startup Code PL/SQL code executed when a menu module is loaded in memory
Share Library Property that enables the loading into memory of a single copy of a PL/
with Form SQL library, if this is the library used by the form module and the menu
module
Use Security When set to Yes, this property enforces security at run time. (Set this
property to No to test the menu module without having to be a member
of any database role.)
Module Roles Property that displays the Menu Module Roles dialog box, where you
can list the roles assigned to the menu module. (Roles defined must be
assigned to individual menu items in the Menu Editor.)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-13
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Menu Properties
......................................................................................................................................................
1-14 Oracle iDS Forms: Build Internet Applications II
Menu Properties
......................................................................................................................................................
Menu Properties
Property Description
Tear-Off Menu Enables the menu to be dragged from the menu bar and repositioned
elsewhere on the screen (available only if your window manager
supports this feature)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-15
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Technical Note
Radio menu items must belong to a radio group. All of the radio items for a radio
group must be contiguous on the same menu. Radio group names are internal names
that are not displayed at run time.
......................................................................................................................................................
1-16 Oracle iDS Forms: Build Internet Applications II
Menu Item Properties
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-17
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Plain
Check
Radio
Magic
Separator
Magic Items
About Paste
Undo Help
Clear Quit
Copy Window
Cut
......................................................................................................................................................
1-18 Oracle iDS Forms: Build Internet Applications II
Menu Item Types
......................................................................................................................................................
Magic Items
Some Magic menu items include default functionality. Because a Magic item
provides the standard actions of a graphical user interface (GUI), a copy or
paste action is already defined at the menu level. All you need to do is set the
item to the Magic type and define the desired action (standard or specific).
Magic Item Command Type Default Functionality?
About Any except Menu No. You must assign a command to these
Undo items to perform the desired function.
Clear Null Yes. These items perform the default
Copy operations indicated by their names.
Paste
Cut
Help Menu No. You must define a submenu to be
called by the Magic Help item, and you
must assign commands to the items on
that submenu.
Quit Null Yes. The Quit command, by default, exits
from the form after asking the user to
save any changes.
Window Null or Menu Yes. The window item invokes a default
submenu that lists all open windows.
Users can activate a window by selecting
it from the submenu.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-19
Lesson 1: Creating a Menu Module
......................................................................................................................................................
......................................................................................................................................................
1-20 Oracle iDS Forms: Build Internet Applications II
Menu Item Command Types
......................................................................................................................................................
Note: The command types of Form, Plus and Macro are available for backward
compatibility only.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-21
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Technical Note
For more flexible or complex requirements, use the existing Toolbar canvas in form
modules.
......................................................................................................................................................
1-22 Oracle iDS Forms: Build Internet Applications II
Implementing Menu Toolbars
......................................................................................................................................................
Property Description
Visible in Horizontal Specifies that the menu item should appear (represented by an
Menu Toolbar icon) on the horizontal toolbar of a form
Visible in Vertical Specifies that the menu item should appear (represented by an
Menu Toolbar icon) on the vertical toolbar of a form
Icon Filename Specifies the name of the icon resource that you want to represent
the iconic button. For Web-deployed forms, this should be a GIF
file, otherwise use an ICO file.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-23
Lesson 1: Creating a Menu Module
......................................................................................................................................................
......................................................................................................................................................
1-24 Oracle iDS Forms: Build Internet Applications II
Storing the Menu Module
......................................................................................................................................................
You can save your menu module definition by either of the following actions:
Clicking the Save icon in the Object Navigator
Selecting File>Save
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-25
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Menu
module Specify
to use with that menu
this form module
module is stored
in the file
system
Technical Note
If you want to use the Default menu without the associated menu toolbar, replace the
value DEFAULT&SMARTBAR in the Menu Module property with DEFAULT only.
......................................................................................................................................................
1-26 Oracle iDS Forms: Build Internet Applications II
Attaching the Menu Module
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-27
Lesson 1: Creating a Menu Module
......................................................................................................................................................
......................................................................................................................................................
1-28 Oracle iDS Forms: Build Internet Applications II
Pop-up Menus
......................................................................................................................................................
Pop-up Menus
Pop-up menus are context-sensitive menus. You attach pop-up menus to an item or
canvas, and display them by right click on that item or canvas. Pop-up menus enable
end users to quickly access common functions and commands.
Pop-up menus are top-level objects in the Object Navigator (similar to alerts, blocks,
canvases, and so on) and belong to a form module, as opposed to form menus, which
belong to a separate menu module.
Items on a pop-up menu should be contextual to the menus associated objects. For
example, you would not include text-editing items on the pop-up menu for a two-digit
numeric item. However, you might include such items on the pop-up menu for a
multiline text item.
Pre-Popup-Menu Trigger
You can use this trigger to add dynamic control at run time, prior to displaying the
menu. For example, you can use the trigger to identify the cursor context and navigate
to a different item if necessary.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-29
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Summary
......................................................................................................................................................
1-30 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
In this lesson, you learned how to add, create, and customize menu modules.
Properties
Menu module properties
Menu properties
Menu item properties
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-31
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Practice 1 Overview
......................................................................................................................................................
1-32 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 1
......................................................................................................................................................
Practice Contents
Create a simple menu module
Incorporate menu items in the menu toolbar
Compile and attach a menu to a form
Create a pop-up menu
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-33
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Practice 1
1 Create a new menu module.
a Using the following screenshot as a guideline, create a new menu
module called M_SUMMITXX where XX is your student course
number.
File Menu
Visible in
Menu Visible Horiz.
Item Command Menu Item in Menu Icon
Label Type Type Code Menu Toolbar Filename
Save Plain PL/SQL DO_KEY(CO Yes Yes Save
MMIT_FORM
);
Clear Plain PL/SQL DO_KEY( Yes Yes Abort
CLEAR_FORM
);
Null1 Separator Null Yes Yes
Exit Plain PL/SQL DO_KEY( Yes Yes Exit
EXIT_FORM
);
Null2 Separator Null No Yes
......................................................................................................................................................
1-34 Oracle iDS Forms: Build Internet Applications II
Practice 1
......................................................................................................................................................
Edit Menu
Visible in
Menu Magic Command Visible Horiz. Menu Icon
Label Item Type Item Type in Menu Toolbar Filename
Cut Magic Cut Null Yes Yes Cut
Copy Magic Copy Null Yes Yes Copy
Paste Magic Paste Null Yes Yes Paste
Null3 Separator Null No Yes
Sort By Menu
Query Menu
Visible in
Menu Command Horiz. Menu Icon
Label Item Type Type Menu Item Code Toolbar Filename
Enter Plain PL/SQL DO_KEY( Yes query
Query ENTER_QUERY);
eXe- Plain PL/SQL DO_KEY(EXECUT Yes execute
cute E_QUERY);
Query
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-35
Lesson 1: Creating a Menu Module
......................................................................................................................................................
......................................................................................................................................................
1-36 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
2-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn how to modify menus dynamically, as well as
how to control application security through menu access.
Objectives
After completing this lesson, you should be able to do the following:
Control the menu programmatically by using menu built-ins
Implement menu security by using both database roles and the
appropriate built-ins
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-3
Lesson 2: Managing Menu Modules
......................................................................................................................................................
......................................................................................................................................................
2-4 Oracle iDS Forms: Build Internet Applications II
Using PL/SQL in Menu Item Code
......................................................................................................................................................
Restrictions
Menu modules are generated independently of form modules.
In PL/SQL command menu items:
You cannot directly reference the value of form module objects.
You must use the NAME_IN built-in function to determine the current
value of the object.
You cannot use direct assignment to set the value of a form module
object.
You must use the COPY built-in procedure.
Example
IF :s_emp.title = MANAGER THEN ...-- INCORRECT
IF NAME_IN(s_emp.title) = MANAGER THEN ... -- CORRECT
:s_product.name := PUMP; -- INCORRECT
COPY(PUMP, s_product.name); -- CORRECT
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-5
Lesson 2: Managing Menu Modules
......................................................................................................................................................
FIND_MENU_ITEM
GET_MENU_ITEM_PROPERTY
SET_MENU_ITEM_PROPERTY
ITEM_ENABLED
MENU_SHOW_KEYS
......................................................................................................................................................
2-6 Oracle iDS Forms: Build Internet Applications II
Useful Built-in Menu Subprograms
......................................................................................................................................................
Example
This procedure finds the ID of a menu item before setting multiple properties.
DECLARE
mi_id MenuItem;
BEGIN
mi_id := Find_Menu_Item(Preferences.AutoCommit);
/* Determine the current checked state of the AutoCommit menu
checkbox item and toggle the checked state */
IF Get_Menu_Item_Property(mi_id,CHECKED) = TRUE THEN
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_FALSE);
ELSE
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_TRUE);
END IF;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-7
Lesson 2: Managing Menu Modules
......................................................................................................................................................
REPLACE_MENU
Character mode built-ins:
HIDE_MENU
SHOW_MENU
MENU_REDISPLAY
Technical Note
REPLACE_MENU replaces the menu for all windows in the application. If
you are using CALL_FORM, REPLACE_MENU replaces the menu for
both the calling form and the called form with the specified menu.
......................................................................................................................................................
2-8 Oracle iDS Forms: Build Internet Applications II
Showing and Hiding the Current Menu
......................................................................................................................................................
Example
Use a standard procedure to change which root menu in the current menu
application appears in the menu bar. A single menu application may have
multiple root menus, which an application can set dynamically at run time.
PROCEDURE Change_Root_To(root_menu_name VARCHAR2) IS
BEGIN
Replace_Menu(MYAPPLSTD, PULL_DOWN, root_menu_name);
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-9
Lesson 2: Managing Menu Modules
......................................................................................................................................................
What Is a Role?
Users
Role
Privileges
......................................................................................................................................................
2-10 Oracle iDS Forms: Build Internet Applications II
Managing Menu Security
......................................................................................................................................................
What Is a Role?
A role is a group of users sharing the same privileges. With Form Builder,
you can manage menu security through Oracle server roles.
When you create a role, you can grant access privileges to each item
individually. If access is granted only to some roles, only users belonging to
those roles can access those items.
Using this feature, you can deliver the same application for different kinds
of users.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-11
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Technical Note
If Use Security is modified, you must recompile the menu module.
......................................................................................................................................................
2-12 Oracle iDS Forms: Build Internet Applications II
Defining Security Roles
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-13
Lesson 2: Managing Menu Modules
......................................................................................................................................................
......................................................................................................................................................
2-14 Oracle iDS Forms: Build Internet Applications II
Assigning Access to Menu Items
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-15
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Summary
......................................................................................................................................................
2-16 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
PL/SQL in Menu Item Commands
Typical PL/SQL uses
Restrictions for PL/SQL in menu item commands
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-17
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Practice 2 Overview
......................................................................................................................................................
2-18 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 2
......................................................................................................................................................
Practice Contents
Add a check menu item.
Enhance the menu so that the Display Help menu item is synchronized
with the ORDERS Help button. If the Help button is enabled, a
checkmark should appear next to the Display Help menu item.
For the CUSTOMERS form, hide the menu items that are not relevant.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-19
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Practice 2
1 Define a check menu item.
a Open your M_SUMMIT menu module and add a new menu item to
the Sort By menu; name it Display_Help.
......................................................................................................................................................
2-20 Oracle iDS Forms: Build Internet Applications II
................................
Programming
Function Keys
Lesson 3: Programming Function Keys
......................................................................................................................................................
Objectives
......................................................................................................................................................
3-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
Form Builder enables you to redefine the actions of function keys. This
lesson shows you how to create key triggers to either intercept, or
supplement, the usual function key behavior with which your users navigate
the Oracle Forms Developer application.
Objectives
After completing this lesson, you should be able to do the following:
Define key triggers and their uses
Program function keys
Classify key triggers
Associate function keys with interface controls
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-3
Lesson 3: Programming Function Keys
......................................................................................................................................................
Key Triggers
SET_ALERT_PROPERTY(question_alert
SET_ALERT_PROPERTY( question_alert,, ALERT_MESSAGE_TEXT,
ALERT_MESSAGE_TEXT,
Do really want to leave the form? );
Do you really want to leave the form?
you );
IF SHOW_ALERT(question_alert
IF SHOW_ALERT( question_alert)) == ALERT_BUTTON1
ALERT_BUTTON1 THEN
THEN
EXIT_FORM; -- default functionality
EXIT_FORM; -- default functionality
END
END IF;
IF;
......................................................................................................................................................
3-4 Oracle iDS Forms: Build Internet Applications II
Key Triggers
......................................................................................................................................................
Key Triggers
If you press a function key, Forms usually performs the default function
associated with that key. You can modify the standard functionality of a
function key by defining a key trigger for that function key.
Example
The form level Key-Exit trigger below displays an alert asking the end user
if he or she wants to leave the form.
SET_ALERT_PROPERTY(question_alert, ALERT_MESSAGE_TEXT, Do
you really want to leave the form?);
IF SHOW_ALERT(question_alert) = ALERT_BUTTON1 THEN
EXIT_FORM; -- default functionality
END IF;
Note: If you also want to execute the default functionality of the function
key, you must ensure that the key trigger includes the built-in function
associated with the key.
Example
The following form-level Key-Menu trigger disables [Block Menu] for a
form.
BEGIN
NULL;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-5
Lesson 3: Programming Function Keys
......................................................................................................................................................
......................................................................................................................................................
3-6 Oracle iDS Forms: Build Internet Applications II
Defining Key Triggers
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-7
Lesson 3: Programming Function Keys
......................................................................................................................................................
......................................................................................................................................................
3-8 Oracle iDS Forms: Build Internet Applications II
Characteristics of Key Triggers
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-9
Lesson 3: Programming Function Keys
......................................................................................................................................................
Technical Note
The function keys Fn do not necessarily map to F1, F2, F3, and so on.
......................................................................................................................................................
3-10 Oracle iDS Forms: Build Internet Applications II
Classification of Key Triggers
......................................................................................................................................................
Key Mapping
Key mapping is defined by a platform specific resource file. The key
definition file for the Microsoft Windows platform is FMRUSW.RES. You
should use Oracle Terminal to edit Client Server resource files. For Web
applications, you can edit the Java resource file, FMRWEB.RES, with any
suitable operating system editor.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-11
Lesson 3: Programming Function Keys
......................................................................................................................................................
Technical Note
Since mouse-event key triggers are not executed when the mouse is used to
initiate window interaction, you should not place code that needs to be
executed every time the window interaction occurs in a mouse-event key
trigger.
......................................................................................................................................................
3-12 Oracle iDS Forms: Build Internet Applications II
Classification of Key Triggers
......................................................................................................................................................
Examples
The Key-Nxtblk trigger is a mouse-event key trigger, because the
NEXT_BLOCK functionality can also be activated using the mouse by
clicking in the next block. In this case, a possible Key-Nxtblk trigger
will not fire.
The Key-Exeqry trigger is not a mouse-event key trigger, because the
EXECUTE_QUERY functionality cannot be activated by simply
clicking the mouse. It can be activated by the mouse only if a trigger is
defined to fire as a result of the mouse action.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-13
Lesson 3: Programming Function Keys
......................................................................................................................................................
......................................................................................................................................................
3-14 Oracle iDS Forms: Build Internet Applications II
Using Key Triggers
......................................................................................................................................................
Common Uses
Disable function keys
Replace or extend the default functionality of function keys
Add additional keys for custom functions using Key-Fn triggers
Disable a set of function keys using Key-Others
Technical Note
To determine if a Key-Others trigger applies to a function key, Forms looks
for associated key triggers at all levels. For example, if you define the
Key-Others trigger at the block level, it will not fire for those function keys
for which a key trigger is defined at the form level.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-15
Lesson 3: Programming Function Keys
......................................................................................................................................................
Syntax: DO_KEY(built_in_name)
Example: To customize actions when a user
exits the form with [Exit Form], a button,
or a menu item:
1. Key-Exit
--
-- custom
custom actions
actions when
when user
user tries
tries to
to exit
exit
EXIT_FORM;
EXIT_FORM;
...
...
......................................................................................................................................................
3-16 Oracle iDS Forms: Build Internet Applications II
Association with Other Interface Controls
......................................................................................................................................................
What Is DO_KEY?
DO_KEY is a built-in function that executes the key trigger that corresponds
to the built-in subprogram specified as its parameter. If no key trigger is
defined, the specified built-in is executed.
Syntax
DO_KEY(built_in_name)
Example
Exit a Form by clicking [Exit Form] or an Exit button, or by choosing a
menu item.
1 Define a Key-Exit trigger at form level.
2 Call DO_KEY by using:
a The When-Button-Pressed trigger on the associated Exit button
b The menu-item code for the menu item that exits the form using
DO_KEY(EXIT_FORM);
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-17
Lesson 3: Programming Function Keys
......................................................................................................................................................
Summary
......................................................................................................................................................
3-18 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Understanding Key Triggers
They fire when the associated function key is pressed.
They are defined like any other trigger.
Special properties are Display in Keyboard Help and Keyboard Help
Text.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-19
Lesson 3: Programming Function Keys
......................................................................................................................................................
Practice 3 Overview
......................................................................................................................................................
3-20 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 3
......................................................................................................................................................
Practice Contents
Use a key trigger to redefine [Exit Form] to provide consistent behavior
between Menu and form modules.
Disable [Enter Query] mode, and replace with a custom query form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-21
Lesson 3: Programming Function Keys
......................................................................................................................................................
Practice 3
1 Maintain consistent functionality in your form module by using key
triggers. Define a key trigger in your ORDERS form to give users
consistent functionality whenever they exit the form, either using the
menu or when the CONTROL.EXIT_BUTTON button is pressed.
a Redefine [Exit Form] in your ORDERS form so that an alert
message is displayed to users before allowing them to exit the form.
b Amend the entry in Keyboard Help to Exit Orders for the key
trigger.
c Save and compile your form. Deploy your form to the Web to test.
d Customize the Alert Text message in your key trigger and ensure that
it is displayed whenever the user exits the form using the
EXIT_BUTTON on the Control block.
e Save and compile your form module. Deploy to the Web and test
your form.
......................................................................................................................................................
3-22 Oracle iDS Forms: Build Internet Applications II
................................
Responding to Mouse
Events
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Objectives
......................................................................................................................................................
4-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
The keyboard, menu, and mouse are the operators tools for interacting with
the Forms application. This lesson demonstrates how to write an application
that responds to mouse events.
Objectives
After completing this lesson, you should be able to do the following:
Define mouse events
Cause a form module to respond to mouse movement
Cause a form module to respond to mouse button actions
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-3
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Mouse Events
SET_APPLICATION_PROPERTY(CURSOR_STYLE,
value);
......................................................................................................................................................
4-4 Oracle iDS Forms: Build Internet Applications II
What Are Mouse Events?
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-5
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
When-Mouse-Enter
When-Mouse-Leave
When-Mouse-Move
......................................................................................................................................................
4-6 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Movement
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-7
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
2 7
6
3
1 MOUSE_FORM 5 MOUSE_RECORD_OFFSET
2 MOUSE_CANVAS 6 MOUSE_X_POS
3 MOUSE_ITEM 7 MOUSE_Y_POS
4 MOUSE_RECORD
Technical Note
The SYSTEM.MOUSE_FORM system variable is NULL if the platform is
not a GUI platform.
......................................................................................................................................................
4-8 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Movement
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-9
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
When-Mouse-Down
When-Mouse-Up
When-Mouse-Click
click
When-Mouse-Doubleclick
click click
1. When-Mouse-Down
2. When-Mouse-Up
3. When-Mouse-Click
4. When-Mouse-Down
5. When-Mouse-Up
6. When-Mouse-Doubleclick
Technical Note
Click and double-click work only if the mouse stays on the item (or canvas)
throughout the down-up action.
......................................................................................................................................................
4-10 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Button Actions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-11
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
SYSTEM.MOUSE_BUTTON_PRESSED
SYSTEM.MOUSE_BUTTON_MODIFIERS
Ctrl Alt
......................................................................................................................................................
4-12 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Button Actions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-13
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Summary
......................................................................................................................................................
4-14 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
In this lesson, you saw how to write an application that responds to mouse
events.
Mouse Events
Entry to a canvas or an item
Exit from a canvas or an item
Move the cursor
Click
Double-click
Up
Down
Responding to mouse movement
Mouse position system variables
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-15
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Practice 4 Overview
......................................................................................................................................................
4-16 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 4
......................................................................................................................................................
Practice Contents
Define a mouse-event trigger to invoke an editor on the
S_CUSTOMER.COMMENTS item.
Modify the mouse cursor style whenever the ORDERS Help canvas is
displayed.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-17
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Practice 4
In this practice, you provide additional functionality in your forms by
defining mouse event triggers.
......................................................................................................................................................
4-18 Oracle iDS Forms: Build Internet Applications II
................................
Controlling Windows
and Canvases
Programmatically
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Objectives
......................................................................................................................................................
5-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
You should already be familiar with setting window and canvas properties at design
time. This lesson covers the triggers and built-ins that you can use to manage the
properties and behavior of windows and canvases at run time.
Objectives
After completing this lesson, you should be able to do the following:
Display a form module in multiple windows
Write code to interact with windows
Manipulate windows programmatically
Manipulate canvas views programmatically
Control windows and canvases with Web-deployed forms
Display large data blocks in a window
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-3
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
System Variable
:SYSTEM.EVENT_WINDOW
Trigger Use
......................................................................................................................................................
5-4 Oracle iDS Forms: Build Internet Applications II
Using Window-Interaction Triggers
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-5
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
FIND_WINDOW
GET_WINDOW_PROPERTY
SET_WINDOW_PROPERTY
HIDE_WINDOW
SHOW_WINDOW
MOVE_WINDOW
RESIZE_WINDOW
Technical Note
In Microsoft Windows, you can reference the multiple document interface
(MDI) application window with the FORMS_MDI_WINDOW constant.
FORMS_MDI_WINDOW is used with certain built-in functions and
procedures that relate to windows.
In Web-deployed forms, you can obtain similar functionality by setting
the Forms Applet WIDTH and HEIGHT parameters in the base HTML page.
Definition of these Form Applet parameters is covered later in this course.
......................................................................................................................................................
5-6 Oracle iDS Forms: Build Internet Applications II
Built-ins for Manipulating Windows
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-7
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
FIND_CANVAS
GET_CANVAS_PROPERTY
SET_CANVAS_PROPERTY
FIND_VIEW
GET_VIEW_PROPERTY
SET_VIEW_PROPERTY
HIDE_VIEW
SHOW_VIEW
REPLACE_CONTENT_VIEW
SCROLL_VIEW
Technical Note
REPLACE_CONTENT_VIEW does not hide the stacked canvas already displayed
in the window. In contrast SHOW_VIEW and SET_VIEW_PROPERTY will display
the given canvas in front of any stacked canvas, if the canvas Visible property is set to
true.
......................................................................................................................................................
5-8 Oracle iDS Forms: Build Internet Applications II
Built-ins for Manipulating Canvases
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-9
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Clicks a tab
......................................................................................................................................................
5-10 Oracle iDS Forms: Build Internet Applications II
Working with Tab-Style Canvases
......................................................................................................................................................
Technical Note
When you are changing to another tab page, the cursor does not automatically move to
a different item. To move the cursor you must include a GO_ITEM statement in the
When-Tab-Page-Changed trigger. This is intended functionality to allow users to view
other tab pages without navigating the cursor and therefore causing item navigation
and validation (as previously mentioned).
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-11
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
If GET_CANVAS_PROPERTY(custab,
TOPMOST_TAB_PAGE)= Billing then
SET_CANVAS_PROPERTY(custab,
TOPMOST_TAB_PAGE,
Address);
end if;
......................................................................................................................................................
5-12 Oracle iDS Forms: Build Internet Applications II
Working with Tab-Style Canvases
......................................................................................................................................................
Example
DECLARE
tp_id Tab_Page;
BEGIN
tp_id := Find_Tab_Page(Canvas2.TabPage1);
IF Get_Tab_Page_Property(tp_id, enabled) =FALSE THEN
Set_Tab_Page_Property(tp_id, enabled, property_true);
END IF;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-13
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Window 2
Block 2
Block 3
Cursor
location
......................................................................................................................................................
5-14 Oracle iDS Forms: Build Internet Applications II
Windows and Blocks
......................................................................................................................................................
Transaction Management
During commit processing, Forms processes all base table blocks in
sequential order. Therefore, transaction management is block-based rather than
window-based. However, the user expects to interact with a form in a window-based
manner.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-15
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
SET_WINDOW_PROPERTY
SET_WINDOW_PROPERTY (forms_mdi_window,
(forms_mdi_window,
window_state,
window_state, maximize);
maximize);
Technical Note
You can also maximize the client server MDI window application with the
WINDOW_STATE command line parameter:
ifrun60.exe module=customer.fmx userid=my_name/my_password@my_database
window_state=maximize
You can switch from the MDI to the SDI window application by using the USESDI
command line parameter:
ifrun60.exe module=customer.fmx userid=my_name/my_password@my_database
usesdi=yes
With SDI window applications, you must size form module windows to allow for the
menu, menu toolbar, and console bar to display.
......................................................................................................................................................
5-16 Oracle iDS Forms: Build Internet Applications II
Manipulating Window Properties Programmatically
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-17
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
......................................................................................................................................................
5-18 Oracle iDS Forms: Build Internet Applications II
Closing Windows
......................................................................................................................................................
Closing Windows
Use the Microsoft Windows close button, or system-menu box, to provide the user
with a means for closing windows. There is no default behavior in Forms when a user
clicks on the close button, therefore you must define a When-Window-Closed trigger.
The following examples show a form based on departments and employees. The
department block and the employee block are located in separate windows. The form
level triggers When-Window-Closed and When-Window-Activated implement the
following functionality:
Exiting from the form or hiding the window that is closed by the user
(Forms automatically activates another window.)
Forcing navigation in the newly activated window
Note: The function GET_CURSOR_WINDOW, discussed in an earlier example, is
used here.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-19
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
WIDTH=650
HEIGHT=400
usesdi=no
......................................................................................................................................................
5-20 Oracle iDS Forms: Build Internet Applications II
Manipulating Windows in Web-Deployed Forms
......................................................................................................................................................
The base HTML file is downloaded when a user requests your forms application from
the Web server. It contains information that would otherwise be supplied with the
client server RUNFORM command.
Information on building the base HTML file is covered in the course Oracle 9iAS
Forms Services: Deploy Internet Applications.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-21
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
usesdi=yes
separateFrame=true
......................................................................................................................................................
5-22 Oracle iDS Forms: Build Internet Applications II
Sizing Windows for Web-Deployed Forms
......................................................................................................................................................
If your form module canvases must be larger than the Applet window, then you should
either specify window scrollbars, or consider other Form Builder features such as Tab
canvases, Tree objects, and scrollable Stacked canvases. With these you can extend
the available canvas area within a form module without creating large canvases.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-23
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
......................................................................................................................................................
5-24 Oracle iDS Forms: Build Internet Applications II
Display Large Data Blocks in a Window
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-25
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Managing Images
for Web-Deployed Forms
......................................................................................................................................................
5-26 Oracle iDS Forms: Build Internet Applications II
Managing Images for Web-Deployed Forms
......................................................................................................................................................
Parameter Description
splashScreen Identifies the file containing image to be displayed
backGround Identifies the file containing image background
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-27
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
5-28 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Window-Interaction Triggers
When-Window-Activated
When-Window-Deactivated
When-Window-Closed
When-Window-Resized
Use the SYSTEM.EVENT_WINDOW system variable to keep track
of the triggered window.
Web-deployed Forms
MDI and SDI windows
Applet Areas
Separate frames
Display Large Data Blocks
Splash Screens and Background Images
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-29
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Practice 5 Overview
......................................................................................................................................................
5-30 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 5
......................................................................................................................................................
Practice Contents
Build a multiple-window form and use the appropriate window
interaction triggers and built-ins to:
- Exit the form when in the primary content canvas window
- Navigate to the primary content canvas window when closing
another window in the form
- Enforce navigation between form windows
Customize tab page navigation.
Disable the Customers comment tab page when there is no data to
display.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-31
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Practice 5
1 Manipulate a multiple-window form.
a In your ORDERS form module, ensure that the form is exited when a
user closes the Orders window using the window system menu box.
An alert should be displayed to users asking them to confirm that
they wish to leave the application.
b If a user closes the Inventory window through the system menu box,
ensure that the form remains open with the cursor positioned in the
Orders window.
c Whenever the user navigates between the Order and Inventory
windows, place the cursor in the first navigable item within the
current window.
d Save and compile your form. Deploy your form to the Web to test.
4 How can you enforce item navigation dynamically within a tab page?
......................................................................................................................................................
5-32 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
Objectives
......................................................................................................................................................
6-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson introduces you to the different data source types that you can use
for data blocks. This lesson also provides you with some guidelines for
choosing the best data source for the job.
Objectives
After completing this lesson, you should be able to do the following:
Describe the various data source types
Base a data block on a FROM clause query
Discuss the advantages of using a FROM clause query
Base a data block on a stored procedure that returns a REF cursor
Select the appropriate data source for a data block
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-3
Lesson 6: Defining Data Sources
......................................................................................................................................................
Query DML
Table Table
FROM clause Company Name:
query
Company Code:
Stored Stored
procedure Balance: procedure
Transactional Transactional
trigger trigger
......................................................................................................................................................
6-4 Oracle iDS Forms: Build Internet Applications II
Data Source Types
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-5
Lesson 6: Defining Data Sources
......................................................................................................................................................
SELECT...
FROM...
(SELECT...
FROM...
WHERE... WHERE...)
......................................................................................................................................................
6-6 Oracle iDS Forms: Build Internet Applications II
Basing a Data Block on a FROM Clause Query
......................................................................................................................................................
Example
SELECT deptno, sal_total
FROM
( SELECT deptno, SUM(sal) sal_total
FROM emp
HAVING SUM(sal) > 5000
GROUP BY deptno
)
ORDER BY deptno ;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-7
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-8 Oracle iDS Forms: Build Internet Applications II
Basing a Data Block on a Stored Procedure
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-9
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-10 Oracle iDS Forms: Build Internet Applications II
Example of a Query Using a REF Cursor Procedure
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-11
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-12 Oracle iDS Forms: Build Internet Applications II
Example of Query Using a Table of Records Procedure
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-13
Lesson 6: Defining Data Sources
......................................................................................................................................................
Note
See Appendix F, Handling Server-Side Errors for code details.
......................................................................................................................................................
6-14 Oracle iDS Forms: Build Internet Applications II
Example of DML Using a Stored Procedure
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-15
Lesson 6: Defining Data Sources
......................................................................................................................................................
SQL
SELECT
Procedure
REF cursor
3
Fetched rows
4
Any
PL/SQL
code
Procedure
Query 1 2 Cursor
Cursor
3
Table of records
4
......................................................................................................................................................
6-16 Oracle iDS Forms: Build Internet Applications II
Deciding Whether to Use a REF Cursor or a Table of Records
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-17
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-18 Oracle iDS Forms: Build Internet Applications II
Data Block Wizard
......................................................................................................................................................
Property Description
Data source type Specifies if the data block is based on a table or a stored procedure
Query procedure Name of the procedure used to query rows
Insert procedure Name of the procedure used to insert rows
Update procedure Name of the procedure used to update rows
Delete procedure Name of the procedure used to delete rows
Lock procedure Name of the procedure used to lock rows
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-19
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-20 Oracle iDS Forms: Build Internet Applications II
Data Block Properties
......................................................................................................................................................
Property Description
Query Data Source Type Specifies the query data source type for the data block
Query Data Source Name Specifies the name of the block query data source.
(Used when the query data source type is Table, Sub-
query, or Procedure.)
Query Data Source Columns Specifies the names and data types of columns associ-
ated with the query data source. (Used when the query
data source type is Table, Subquery, or Procedure.)
Query Data Source Arguments Specifies the names, data types, and values of the argu-
ments that are to be passed to the procedure for query-
ing data (Used only if the query data source type is
Procedure.)
Property Description
DML Data Target Type Specifies the DML data source type for the data block
DML Data Target Name Specifies the name of the DML data source for the data
block (Used only if the DML data target type is Table.)
(Insert, Update, Delete, Lock) Specifies the name of the procedure to be used (Used
Procedure Name only if the DML data target type is Procedure.)
(Insert, Update, Delete, Lock) Specifies the names and data types of the
Procedure Result Set Columns result set columns associated with the
procedure (Used only if the DML data
target type is Procedure.)
(Insert, Update, Delete, Lock) Specifies the names, data types, and values
Procedure Arguments of the arguments that are to be passed to the
procedure (Used only if DML data target
type is Procedure.)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-21
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-22 Oracle iDS Forms: Build Internet Applications II
Data Source Guidelines
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-23
Lesson 6: Defining Data Sources
......................................................................................................................................................
......................................................................................................................................................
6-24 Oracle iDS Forms: Build Internet Applications II
Data Source Guidelines
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-25
Lesson 6: Defining Data Sources
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
6-26 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
New Data Sources
Stored procedure (query and DML)
FROM clause query (query only)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-27
Lesson 6: Defining Data Sources
......................................................................................................................................................
Practice 6 Overview
......................................................................................................................................................
6-28 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 6
......................................................................................................................................................
Practice Contents
Create a package containing a stored procedure to return a REF Cursor
Create a data block based on a stored procedure
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-29
Lesson 6: Defining Data Sources
......................................................................................................................................................
Practice 6
1 Create a server-side package containing a procedure to return a REF
cursor.
a Create the Orders_pkg package specification; you can import the
code from the pr6_1.txt file.
b Create the Orders_pkg package body; you can import the code from
the pr6_2.txt file.
c Examine the Orders_pkg package body to identify required
parameter values.
......................................................................................................................................................
6-30 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
7-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson reviews certain object features of Oracle8i and explains how
these objects are displayed in the Object Navigator.
Objectives
After completing this lesson, you should be able to do the following:
Recognize which Oracle8i object types are supported
Describe how Oracle8i objects are represented within Form Builder
Create a block based on an object table
Create a block based on a relational table with an object column or REF
column
Populate a REF column with an LOV
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-3
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Object Types
Attributes
Ship
ORDER
Check po_no Cancel
status custinfo
line_items
amount
Hold
Methods
......................................................................................................................................................
7-4 Oracle iDS Forms: Build Internet Applications II
What Are Object Types?
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-5
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Review of Objects
Object tables
Object columns
Object views
INSTEAD-OF triggers
DECLARE
BEGIN
EXCEPTION
END;
......................................................................................................................................................
7-6 Oracle iDS Forms: Build Internet Applications II
Review of Objects
......................................................................................................................................................
Review of Objects
With an object type, you can create object tables, object columns, object
views, and INSTEAD-OF triggers.
Object Tables
After you have declared an object type, you can create objects based on the
type. One way to do this is to create a table whose rows are objects of that
object type. Rows in an object table are assigned object IDs (OIDs) and can
be referenced using a REF type.
Object Column
Another construct that can be based on an object type is an object column in
a relational table. In the object table, the rows of a table are objects. In a
relational table with an object column, the column is an object. The table
usually has standard columns, as well as one or more object columns. Object
columns are not assigned OIDs, and thus cannot be referenced using object
REF values.
Object View
An object view transforms the way a table appears to a user, without
changing the actual structure of the table. Object views make relational
tables look like object tables. Objects accessed through object views are
assigned OIDs, and can be referenced using object REFs.
INSTEAD OF Triggers
INSTEAD OF triggers provide a transparent way of modifying views that
cannot be modified directly through SQL DML statements (INSERT,
UPDATE, and DELETE). These triggers are called INSTEAD-OF triggers
because, unlike with other types of triggers, the Oracle server fires the
trigger instead of executing the triggering statement. The trigger performs
update, insert, or delete operations directly on the underlying tables.
Technical Note
The Database Trigger Editor includes the INSTEAD-OF triggering event.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-7
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
References to Objects
......................................................................................................................................................
7-8 Oracle iDS Forms: Build Internet Applications II
Object REFs
......................................................................................................................................................
Object REFs
When a row in an object table or object view is created, it is automatically
assigned a unique identifier called an object ID (OID). This OID value can
be stored in attributes of other objects, or columns of other tables. The stored
copy of the OID then becomes a pointer, or REF, to the original object.
(Object columns are not assigned OIDs and cannot be pointed to by a REF.)
In relational databases, primary key values are used to identify records
uniquely. In object-relational databases, OIDs provide an alternate method.
With relational tables, you can associate two records by storing the primary
key of one record in one of the columns (the foreign key column) of another.
In a similar way, you can associate two objects by storing the OID of one
object in an attribute of another, you can associate a row in a relational table
to an object by storing the OID of an object in a column of a relational table.
The attribute or column that holds the OID is of data type REF.
Remember, only the OID value for the object is stored in the table, not the
object itself.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-9
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-10 Oracle iDS Forms: Build Internet Applications II
Supported Oracle8i Features
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-11
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Object_A Object_A
Attr_A1 Attr_A1
Attr_A2
Object_B
Attr_B1 Attr_A2_B1
Attr_B2 Attr_A2_B2
Attr_A3 Attr_A3
......................................................................................................................................................
7-12 Oracle iDS Forms: Build Internet Applications II
How Oracle Forms Developer Treats Objects
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-13
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Object Display
Object Column
Object Table
Object REF
Object Type
......................................................................................................................................................
7-14 Oracle iDS Forms: Build Internet Applications II
Object Type Displays
......................................................................................................................................................
-- object table
CREATE TABLE oo_dept_table OF dept_type;
-- object column
CREATE TABLE rel_emp_table_ObjCol (
id NUMBER(7),
last_name VARCHAR2(25),
first_name VARCHAR2(25),
userid VARCHAR2(8),
start_date DATE, manager_id
NUMBER(7),
title VARCHAR2(25),
dept_id dept_type,
salary NUMBER(11,2),
commission_pct NUMBER(4,2) );
-- ref column
CREATE TABLE rel_emp_table_RefCol (
id NUMBER(7), last_name VARCHAR2(25),
first_name VARCHAR2(25), userid VARCHAR2(8),
start_date DATE, manager_id NUMBER(7), title
VARCHAR2(25), dept_id REF dept_type,
salary NUMBER(11,2),
commission_pct NUMBER(4,2) );
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-15
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-16 Oracle iDS Forms: Build Internet Applications II
Creating Data Blocks Based on Oracle8i Objects
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-17
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-18 Oracle iDS Forms: Build Internet Applications II
Selecting Object Table Columns
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-19
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-20 Oracle iDS Forms: Build Internet Applications II
Selecting Object Column Attributes
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-21
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-22 Oracle iDS Forms: Build Internet Applications II
Blocks with REF Lookups
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-23
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-24 Oracle iDS Forms: Build Internet Applications II
The REF Column Value
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-25
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
......................................................................................................................................................
7-26 Oracle iDS Forms: Build Internet Applications II
LOVs for REFs
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-27
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Summary
......................................................................................................................................................
7-28 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Oracle Forms Developer supports most, but not all, of the Oracle8i
object types.
In Forms Builder, object types are displayed like columns, where
indentation shows the nesting of objects.
Blocks can be based on object tables.
Blocks based on object or relational tables can include object columns or
REF columns.
REF columns can be populated with an LOV.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-29
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Practice 7 Overview
......................................................................................................................................................
7-30 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 7
......................................................................................................................................................
Practice Contents
Create a block based on a relational table with an object column
Create a block based on a relational table with a REF column
Populate a REF column with an LOV
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-31
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Practice 7
1 Create a data block based on a relational table with an object column.
a Create a form called OBJ_COLXX where XX is your student course
number.
b Using the Data Block Wizard, create a block based on the
REL_EMP_TABLE_OBJCOL relational table.
c Select the columns ID, FIRST_NAME, and LAST_NAME.
d Expand the object column DEPT_ID and select the attributes ID and
NAME. Note the names that are given to the new items.
e In the Layout Wizard, select all available items for display. Change
the prompt for item DEPT_ID to Department ID and
DEPT_ID_NAME to Department Name. Use a form layout.
f Save, compile, and test your form.
......................................................................................................................................................
7-32 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
8-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
You have seen how form modules consist of data blocks based on related
tables. This lesson shows how you can modify the relationship between two
data blocks to affect the way in which deletes are handled and to what extent
the data blocks are coordinated at query time. Also, it explains how to create
relationships based on object REFs.
Objectives
After completing this lesson, you should be able to do the following:
Define block coordination
Coordinate data blocks by using REF relations
Describe the characteristics and principles of relation-handling code
Implement a coordination-type toggle
Force one commit per master record
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-3
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Relations
......................................................................................................................................................
8-4 Oracle iDS Forms: Build Internet Applications II
Creating a Relation
......................................................................................................................................................
Creating a Relation
What Is a Relation?
A relation is a Form Builder object that handles the relationship between
two associated blocks.
You can create a relation either:
Implicitly with a master-detail form module
Explicitly in the Object Navigator
Implicit Relations
When you create a master-detail form module, a relation is automatically
created. This relation is named in the format masterblock_detailblock, for
example, S_ORD_S_ITEM.
Explicit Relations
If a relation is not established when default blocks are created, you can
create your own, either by setting the properties in the master block New
Relation dialog box, or by calling the reentrant wizard for the detail data
block. Like implicitly created relations, PL/SQL program units and triggers
are created automatically when you explicitly create a relation.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-5
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Block Coordination
Coordination-causing event
Block-coordination phases:
Clear phase executed before change
of master record
Populate phase executed after
change of master record
Implementation of block coordination:
The Copy Value from Item property
Relation-handling triggers
Relation-handling procedures
......................................................................................................................................................
8-6 Oracle iDS Forms: Build Internet Applications II
Block Coordination
......................................................................................................................................................
Block Coordination
To maintain a master-detail relationship, Forms coordinates the master and
detail blocks to ensure that only the detail records that belong to the current
master record are displayed.
Coordination-Causing Events
Any event that changes the master record is called a coordination-causing
event or a coordination operation. Forms automatically coordinates the
master and detail blocks again when you move to another master record.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-7
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
......................................................................................................................................................
8-8 Oracle iDS Forms: Build Internet Applications II
Coordinate Blocks Using REFs
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-9
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Characteristics of
Relation-Handling Triggers
Technical Note
Relation-handling triggers fire only if you have defined a corresponding
relation.
......................................................................................................................................................
8-10 Oracle iDS Forms: Build Internet Applications II
Characteristics of Relation-Handling Triggers
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-11
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
......................................................................................................................................................
8-12 Oracle iDS Forms: Build Internet Applications II
Principles of Relation-Handling Code
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-13
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Technical Note
You can use these system variables in the On-Clear-Details trigger only.
Assign their values to global variables to broaden the scope.
......................................................................................................................................................
8-14 Oracle iDS Forms: Build Internet Applications II
Obtaining Relation-Handling Information
......................................................................................................................................................
(*): You can also set those properties using the Set-Relation-Property built-
in.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-15
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Implementing a
Coordination-Type Toggle
Implementing a
Coordination-Type Toggle
......................................................................................................................................................
8-16 Oracle iDS Forms: Build Internet Applications II
Implementing a Coordination-Type Toggle
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-17
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
......................................................................................................................................................
8-18 Oracle iDS Forms: Build Internet Applications II
Forcing a Commit Per Master
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-19
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
8-20 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Creating Relations
Implicitly, when you create a master-detail form module
Explicitly, by creating the relation after the blocks have been created
Block Coordination
Coordination-causing events cause a change of the master record.
The two block-coordination phases are the Clear and Populate phases.
Base coordination of blocks on REF values.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-21
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Practice 8 Overview
......................................................................................................................................................
8-22 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 8
......................................................................................................................................................
Practice Contents
Examining and changing relation properties
Using check boxes to implement a coordination-type toggle for a master-
detail form.
- The first check box should enable a user to toggle between
immediate coordination and deferred coordination.
- The second check box should enable a user to toggle between auto
query and no auto query in the detail block.
Synchronizing the coordination-type toggle at form startup.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-23
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Practice 8
1 Open your ORDERS form and examine the properties of the relation
called S_ORD_S_ITEM.
a Note the deletion and coordination property values.
b Run the ORDERS form and test the way deletes are handled.
2 Implement a query coordination-type toggle.
a Add two check boxes to the control block with the following
properties:
......................................................................................................................................................
8-24 Oracle iDS Forms: Build Internet Applications II
Practice 8
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-25
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
......................................................................................................................................................
8-26 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
Objectives
......................................................................................................................................................
9-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
You have already seen that Oracle Forms Developer applications frequently consist of
more than one form. This lesson revisits the topic of multiple form applications and
takes a deeper look into the ways in which one form module can invoke another and
the effects this has on transaction processing.
Objectives
After completing this lesson, you should be able to do the following:
Describe the various ways of invoking additional form modules
Open, call, and close form modules
Navigate between Web-deployed form modules
Control open form modules and called form modules
Manage transaction processing for open and called form modules
Choose the most appropriate method for invoking form modules
Pass form parameters
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-3
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
OPEN_FORM to Invoke
Additional Forms
Modeless
Different transaction scopes
A B
OPEN_FORM(form_name,
OPEN_FORM(form_name, activate_mode,
activate_mode,
session_mode,
session_mode, data_mode,
data_mode, paramlist);
paramlist);
Characteristics of OPEN_FORM
Restricted
Not valid in Enter Query mode
No savepoint issued
Modeless with respect to other opened forms
Session run time option: FORMS60_SESSION
......................................................................................................................................................
9-4 Oracle iDS Forms: Build Internet Applications II
OPEN_FORM to Invoke Additional Forms
......................................................................................................................................................
Syntax
OPEN_FORM(form_name, activate_mode, session_mode, data_mode,
paramlist);
Parameter Description
form_name The file holding the executable module
activate_mode Either ACTIVATE (the default) or NO_ACTIVATE
session_mode Either NO_SESSION (the default) or SESSION
data_mode Either NO_SHARE_LIBRARY_DATA (the default) or
SHARE_LIBRARY_DATA
paramlist Either the name (in quotes) or internal ID of a parameter list
(This argument is optional.)
Characteristics of OPEN_FORM
Is a restricted procedure
Causes opened form to be modeless
Can start a new database session
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-5
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Closing Forms
CLOSE_FORM:
form_name
form_id
Characteristics of CLOSE_FORM:
Restricted
Not valid in Enter-Query mode
CLOSE_FORM or EXIT_FORM
Cannot close a form that called
another form
......................................................................................................................................................
9-6 Oracle iDS Forms: Build Internet Applications II
Closing Forms
......................................................................................................................................................
Closing Forms
Syntax
CLOSE_FORM(form_name);
CLOSE_FORM(form_id);
Parameter Description
form_name The module name of the form (not the .fmx filename)
form_id The internal form module ID of the form (of type Form Module)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-7
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
......................................................................................................................................................
9-8 Oracle iDS Forms: Build Internet Applications II
Navigating Between Forms
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-9
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Connection
Runform Server
Session
......................................................................................................................................................
9-10 Oracle iDS Forms: Build Internet Applications II
Transaction Processing for Opened Forms
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-11
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
CALL_FORM to Invoke
Additional Forms
Modal
Returns to calling form
A B
CALL_FORM(form_name,
CALL_FORM(form_name, display,
display,
switch_menu,
switch_menu, query_mode,
query_mode,
data_mode,
data_mode, paramlist);
paramlist);
Characteristics of CALL_FORM
Unrestricted
Valid in Enter Query mode
Savepoint issued
Modal with respect to calling form
Does not cause navigation and validation
Forms called from query-only form are
always query-only
Exiting a called form
......................................................................................................................................................
9-12 Oracle iDS Forms: Build Internet Applications II
CALL_FORM to Invoke Additional Forms
......................................................................................................................................................
Syntax
CALL_FORM(form_name, display, switch_menu, query_mode,
data_mode, paramlist);
Parameter Description
form_name The file holding the executable form module
display Either HIDE (the default) or NO_HIDE (This defines whether the call-
ing form should be hidden from view while the called form is running.)
switch_menu Either NO_REPLACE (the default) or DO_REPLACE (This defines
whether the current menu module should be replaced by the default
menu of the called form.)
query_mode Either NO_QUERY_ONLY (the default) or QUERY_ONLY (This
defines whether the called form should run in Query Only mode.)
data_mode Either NO_SHARE_LIBRARY_DATA (the default) or
SHARE_LIBRARY_DATA
paramlist Either the name (in quotes) or internal ID of a parameter list
(This argument is optional.)
Characteristics of CALL_FORM
Is valid in Enter Query mode
Causes Forms to issue a savepoint
Causes called form to be modal
Does not cause navigation or validation in the initial form
Can call a form in Query Only mode
Propagates query-only parameter through all subsequent called forms
Returns control to the calling form and resumes processing of the
PL/SQL code at the statement immediately following the calling
statement (This occurs when Forms exits the called form.)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-13
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Transaction Processing
for Called Forms
......................................................................................................................................................
9-14 Oracle iDS Forms: Build Internet Applications II
Transaction Processing for Called Forms
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-15
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Transaction Processing
for Called Forms
IF
IF <form
<form called>
called> THEN
THEN
POST;
POST;
ELSE
ELSE
COMMIT_FORM;
COMMIT_FORM;
END
END IF;
IF;
Transaction Processing
for Called Forms
Key-Exit on form
......................................................................................................................................................
9-16 Oracle iDS Forms: Build Internet Applications II
Transaction Processing for Called Forms
......................................................................................................................................................
Examples
Key-Commit trigger at form level:
BEGIN
IF GET_APPLICATION_PROPERTY(calling_form) is not null THEN
POST;
ELSE
COMMIT_FORM;
END IF;
END;
Key-Exit trigger at form level:
BEGIN
IF GET_APPLICATION_PROPERTY(calling_form) is not null THEN
EXIT_FORM(ask_commit, no_rollback);
ELSE
EXIT_FORM;
END IF;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-17
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
NEW_FORM to Invoke
Additional Forms
A B
NEW_FORM(form_name,
NEW_FORM(form_name, rollback_mode,
rollback_mode,
query_mode,
query_mode, data_mode,
data_mode,
paramlist);
paramlist);
......................................................................................................................................................
9-18 Oracle iDS Forms: Build Internet Applications II
NEW_FORM to Invoke Additional Forms
......................................................................................................................................................
Syntax
NEW_FORM(form_name, rollback_mode, query_mode, data_mode,
paramlist);
Parameter Description
form_name The file holding the executable form module
rollback_mode Either TO_SAVEPOINT (the default), NO_ROLLBACK, or
FULL_ROLLBACK
query_mode Either NO_QUERY_ONLY (the default) or QUERY_ONLY (This
defines whether the called form should run in Query Only mode.)
data_mode Either NO_SHARE_LIBRARY_DATA (the default) or
SHARE_LIBRARY_DATA
paramlist Either the name (in quotes) or internal ID of a parameter list
(This argument is optional.)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-19
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Controlling Opened
and Called Forms
Form B
OPEN_FORM
S.P. Form F
CALL_FORM
Form E
Form A+B+E = Call form stack
Technical Note
You can obtain information about the call form stack by using the
GET_APPLICATION_PROPERTY built-in with the CALLING_FORM parameter.
......................................................................................................................................................
9-20 Oracle iDS Forms: Build Internet Applications II
Controlling Open Forms and Called Forms Together
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-21
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
......................................................................................................................................................
9-22 Oracle iDS Forms: Build Internet Applications II
Different Ways of Invoking Forms
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-23
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Runform
Form B
command line
Design-time
parameters
Form A P1
P2
Run time
P3
OPEN_FORM
Parameter CALL_FORM
list NEW_FORM
......................................................................................................................................................
9-24 Oracle iDS Forms: Build Internet Applications II
Using Form Parameters
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-25
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
......................................................................................................................................................
9-26 Oracle iDS Forms: Build Internet Applications II
Using Form Parameters
......................................................................................................................................................
Example
Pass a value for the CUS_ID form parameter to the ORDITEM form by way of the
Runtime command line. Note that MODULE and USERID are predefined command
line parameters.
ifrun60.exe module=orditem userid=scott/tiger cus_id=202
Example
Assign the value of the CUS_ID form parameter to the CUSTOMER_ID item in the
ORDER block.
:order.customer_id := :PARAMETER.cus_id;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-27
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Parameter Lists
Parameter
list
OPEN_FORM( , )
CALL_FORM( , )
NEW_FORM( , )
The default parameter list is DEFAULT
Technical Note
The parameters whose values are being passed must be defined in the called form at
design time. That is, the called form must be expecting a value for each of the
parameters included in the parameter list it receives from the calling form.
......................................................................................................................................................
9-28 Oracle iDS Forms: Build Internet Applications II
Parameter Lists
......................................................................................................................................................
Parameter Lists
One way to supply form parameter values is to specify a parameter list in the call to
the built-in that invokes the form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-29
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
CREATE_PARAMETER_LIST
Name Key Type Value
Parameter
ORDERS DATA_PARAMETER RG_ORD
list ID
ADD_PARAMETER
GET_PARAMETER_ATTR
DESTROY_PARAMETER_LIST SET_PARAMETER_ATTR
DELETE_PARAMETER
Technical Note
You cannot create a parameter list named DEFAULT or one that already exists. Use
GET_PARAMETER_LIST and ID_NULL to check whether a parameter list already
exists.
......................................................................................................................................................
9-30 Oracle iDS Forms: Build Internet Applications II
Creating and Manipulating Parameter Lists
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-31
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Technical Note
Global variables are used more often than parameters for passing data between forms.
......................................................................................................................................................
9-32 Oracle iDS Forms: Build Internet Applications II
Passing Data Between Forms
......................................................................................................................................................
Example
The When-Button-Pressed trigger on the CTL.OPEN_ORDITEM item:
DECLARE
v_pl_id PARAMLIST;
BEGIN
IF not ID_NULL(GET_PARAMETER_LIST(cus)) THEN
DESTROY_PARAMETER_LIST(cus);
END IF;
v_pl_id := CREATE_PARAMETER_LIST(cus);
ADD_PARAMETER(v_pl_id,cus_id,text_parameter,
TO_CHAR(:cus.id));
OPEN_FORM(orditem, activate, no_session,
no_share_library_data, cus);
END;
Note: You must define the CUS_ID parameter in the ORDITEM form at design time,
because each run-time parameter must have a corresponding design-time parameter in
the target form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-33
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
9-34 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
The Three Built-ins for Invoking Forms
OPEN_FORM
CALL_FORM
NEW_FORM
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-35
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Practice 9 Overview
......................................................................................................................................................
9-36 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 9
......................................................................................................................................................
Practice Contents
Implement a button on the CUSTOMER form to call the SALESREP form.
Perform an automatic query on the SALESREP form based on the
current sales rep ID in the CUSTOMER form.
Ensure that posted changes in the SALESREP form are not rolled back
on exit.
Pass a parameter list from the CUSTOMERS form to the SALESREP
form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-37
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Practice 9
1 Create a multiple-form application by linking the CUSTOMERS and the
SALESREP forms. The SALESREP form provides a look up facility for
:S_CUSTOMER.SALES_REP_ID. It replaces the SALES_REP_LOV
list of values. Values are selected by mouse double click.
a Open SALESREP form and save as SALESREPXX where XX is
your student course number.
b In your CUSTOMERS form, modify the code in the
SALES_LOV_BUTTON When-Button-Pressed trigger to call the
SALESREP form.
c Ensure that the user can see, but not navigate to, your CUSTOMERS
form, while the SALESREP form is open.
d Update :S_CUSTOMER.SALES_REP_ID with the value selected
by the user in the SALESREP form. The selected Sales Rep ID is
returned in a GLOBAL variable called salesrepid. This variable
contains either a valid value or the text NOT SELECTED.
e Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
9-38 Oracle iDS Forms: Build Internet Applications II
Practice 9
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-39
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
......................................................................................................................................................
9-40 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
Objectives
......................................................................................................................................................
10-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
Record groups are useful constructs for storing structured data, and they can
be manipulated at run time. This lesson covers how to create, modify, and
delete record groups at design time and programmatically at run time. It also
covers how you apply record groups in useful ways, such as for dynamic list
items.
Objectives
After completing this lesson, you should be able to do the following:
Describe the record group object
Use record groups
Define record groups at design time
Control record groups by using built-in functions
Define query record groups programmatically
Define nonquery record groups programmatically
Manipulate record group rows
Define lists of values (LOVs) programmatically
Manipulate list items programmatically
Implement dynamic list items
Add values to combo boxes
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-3
Lesson 10: Working with Record Groups
......................................................................................................................................................
Record Groups
Record Groups
...
...
IF
IF Get_LOV_Property(lov_id,GROUP_NAME)
Get_LOV_Property(lov_id,GROUP_NAME) == GROUP1
GROUP1
THEN
THEN
Set_LOV_Property(lov_id,GROUP_NAME,GROUP2);
Set_LOV_Property(lov_id,GROUP_NAME,GROUP2);
END
END IF;
IF;
...
...
......................................................................................................................................................
10-4 Oracle iDS Forms: Build Internet Applications II
Record Groups
......................................................................................................................................................
Record Groups
What Is a Record Group?
A record group is an internal Forms data structure that is similar to a
database table. It can have columns of type CHAR, NUMBER, or DATE,
and its data is stored in rows. Record groups exist in local Forms memory,
rather than in the database.
Note: When you create a record group, you cannot specify its type
explicitly. The type is implied by when and how you create the record group.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-5
Lesson 10: Working with Record Groups
......................................................................................................................................................
......................................................................................................................................................
10-6 Oracle iDS Forms: Build Internet Applications II
Using Record Groups
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-7
Lesson 10: Working with Record Groups
......................................................................................................................................................
......................................................................................................................................................
10-8 Oracle iDS Forms: Build Internet Applications II
Defining Record Groups at Design Time
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-9
Lesson 10: Working with Record Groups
......................................................................................................................................................
CREATE_GROUP CREATE_GROUP_FROM_QUERY
Record ID Name
Record
group ID group ID
DELETE_GROUP
ADD_GROUP_ROW
DELETE_GROUP_ROW
ADD_GROUP_COLUMN
......................................................................................................................................................
10-10 Oracle iDS Forms: Build Internet Applications II
Built-in Functions for Controlling Record Groups
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-11
Lesson 10: Working with Record Groups
......................................................................................................................................................
ID Name
SET_GROUP_CHAR_CELL
GET_GROUP_NUMBER_CELL
Technical Note
POPULATE_GROUP built-in function returns 0 when population succeeds
and 1 if population does not succeed.
......................................................................................................................................................
10-12 Oracle iDS Forms: Build Internet Applications II
Built-in Functions for Controlling Record Groups
......................................................................................................................................................
Note: You can convert a nonquery record group into a query record group
by using the POPULATE_GROUP_WITH_QUERY built-in function to
populate the nonquery record group.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-13
Lesson 10: Working with Record Groups
......................................................................................................................................................
GET_GROUP_SELECTION_COUNT
GET_
GROUP_
ROW_
SET_GROUP_SELECTION COUNT
GET_GROUP_SELECTION
......................................................................................................................................................
10-14 Oracle iDS Forms: Build Internet Applications II
Built-in Functions for Controlling Record Groups
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-15
Lesson 10: Working with Record Groups
......................................................................................................................................................
Yes ID NULL? No
Populate group
......................................................................................................................................................
10-16 Oracle iDS Forms: Build Internet Applications II
Defining Query Record Groups Programmatically
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-17
Lesson 10: Working with Record Groups
......................................................................................................................................................
Yes ID NULL? No
......................................................................................................................................................
10-18 Oracle iDS Forms: Build Internet Applications II
Defining Nonquery Record Groups Programmatically
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-19
Lesson 10: Working with Record Groups
......................................................................................................................................................
Cell value=
For all given value
group Yes No
rows
Return row
number
Return NULL
......................................................................................................................................................
10-20 Oracle iDS Forms: Build Internet Applications II
Manipulating Record Group Rows
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-21
Lesson 10: Working with Record Groups
......................................................................................................................................................
Row number
For all even?
group Yes No
rows
Mark row
as selected
......................................................................................................................................................
10-22 Oracle iDS Forms: Build Internet Applications II
Manipulating Selected Record Group Rows
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-23
Lesson 10: Working with Record Groups
......................................................................................................................................................
...CREATE_GROUP(group_name,
...CREATE_GROUP(group_name, scope);
scope);
...CREATE_GROUP_FROM_QUERY(group_name,
...CREATE_GROUP_FROM_QUERY(group_name,
query,
query, scope);
scope);
Technical Note
If a global record group is created from (or populated with) a query while
executing a Form A, and the query string contains bind variable references
that are local to A (:block.item or :PARAMETER.param), then when Form
A terminates execution, the global query record group is converted to a
global nonquery record group. The record group retains its data, but a
subsequent POPULATE_GROUP is considered an error.
......................................................................................................................................................
10-24 Oracle iDS Forms: Build Internet Applications II
Defining Global Record Groups
......................................................................................................................................................
Scope Parameter
A scope parameter can be added to the CREATE_GROUP and
CREATE_GROUP_FROM_QUERY built-ins. The value for this scope can
be either:
FORM_SCOPE
GLOBAL_SCOPE
If you omit this parameter, the default is FORM_SCOPE.
Once created, a global record group persists for the remainder of the
application.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-25
Lesson 10: Working with Record Groups
......................................................................................................................................................
ADD_LIST_ELEMENT
DELETE_LIST_ELEMENT
CLEAR_LIST
GET_LIST_ELEMENT_LABEL
GET_LIST_ELEMENT_VALUE
GET_LIST_ELEMENT_COUNT
POPULATE_LIST
RETRIEVE_LIST
POPULATE_LIST RETRIEVE_LIST
......................................................................................................................................................
10-26 Oracle iDS Forms: Build Internet Applications II
Manipulating List Items Programmatically
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-27
Lesson 10: Working with Record Groups
......................................................................................................................................................
Yes ID NULL? No
Populate group
Yes Success? No
Populate list
......................................................................................................................................................
10-28 Oracle iDS Forms: Build Internet Applications II
Implementing Dynamic List Items
......................................................................................................................................................
Technical Note
Because a base table list item must specify a value for either the Initial
property or the Mapping of Other Values property, the record group used to
dynamically populate a list item must also contain this value. Be sure the
record group query returns this value. For more information, see Note
1010798.6, available on MetaLink: http://www.metalink.oracle.com.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-29
Lesson 10: Working with Record Groups
......................................................................................................................................................
Element value=
For all Item value?
list Yes No
elements
Return
......................................................................................................................................................
10-30 Oracle iDS Forms: Build Internet Applications II
Adding Values to Combo Boxes
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-31
Lesson 10: Working with Record Groups
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
10-32 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
A record group is an internal Forms data structure that is similar to a
database table.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-33
Lesson 10: Working with Record Groups
......................................................................................................................................................
Practice 10 Overview
......................................................................................................................................................
10-34 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 10
......................................................................................................................................................
Practice Contents
Convert a text item into a list item that is populated dynamically at run
time by a design-time query record group.
Create a list item that is populated dynamically at run time by a run-time
query record group.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-35
Lesson 10: Working with Record Groups
......................................................................................................................................................
Practice 10
1 Create a dynamic list item populated from a design-time query record
group. The record group will hold region ID and the name of the
departments in the S_DEPT table.
a Open the Employees form. Save as EmpXX where XX is your student
course number. In the Object Navigator, create a record group named
DEPT_ID based on the query below:
SELECT name || in region ||
TO_CHAR(region_id) Name,
TO_CHAR(id) Id
FROM s_dept
UNION
SELECT none Name, 0 Id from dual
ORDER BY 1
b Convert the text item DEPT_ID into a list item, with a Poplist style.
Resize the list item in the Layout Editor.
c Create one element in the list item. Specify a label of Dummy and a
value of 0. Set the Mapping of Other Values property to 0.
d Create a procedure called POPULATE_DEPT_LIST. This procedure
will accept the list item name as an argument and populate the list
item dynamically at run time, using the design-time query record
group.
You can import the code from the pr10_1.txt file.
e Call the procedure each time a new record is created.
f Save and compile your form module to test.
......................................................................................................................................................
10-36 Oracle iDS Forms: Build Internet Applications II
Practice 10
......................................................................................................................................................
a Delete the DEPT_ID record group and remove the code from the
When-Create-Record trigger.
b Create a procedure called CREATE_DEPT_LIST which will
dynamically create a record group called QDEPT, if it does not
already exist. The procedure will also populate the record group by
using the query:
SELECT name ||TO_CHAR(region_id) Name,
TO_CHAR(id) Id
FROM s_dept
UNION
SELECT none Name, to_char(0) Id
FROM dual
ORDER BY 1
c The procedure will also populate the list item S_EMP.DEPT_ID.
d You can import the procedure code from pr10_2.txt file.
e Call the procedure from the When-Create-Record trigger.
f Save and compile your form module to test.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-37
Lesson 10: Working with Record Groups
......................................................................................................................................................
......................................................................................................................................................
10-38 Oracle iDS Forms: Build Internet Applications II
................................
Using Reusable
Components
Lesson 11: Using Reusable Components
......................................................................................................................................................
Objectives
......................................................................................................................................................
11-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn about the reusable components that are
available with Oracle Forms Developer. You will learn how these
components can fit into any application.
Objectives
After completing this lesson, you should be able to do the following:
List the reusable components
Include the calendar object in an application
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-3
Lesson 11: Using Reusable Components
......................................................................................................................................................
Reusable Components
Picklist
Calendar
......................................................................................................................................................
11-4 Oracle iDS Forms: Build Internet Applications II
Reusable Components
......................................................................................................................................................
Reusable Components
Oracle Forms Developer contains a complete set of demonstrations that
illustrate the power and productivity of the product. These demonstrations
contain many tips and techniques that you can copy and use in your own
applications.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-5
Lesson 11: Using Reusable Components
......................................................................................................................................................
ActiveX controls
Java Beans
Sample Icons
Standard Menus
PL/SQL Drag & Drop Library
PL/SQL Utilities Library
PL/SQL Conversion Library
PL/SQL Window System Interface Library
......................................................................................................................................................
11-6 Oracle iDS Forms: Build Internet Applications II
Reusable Components List
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-7
Lesson 11: Using Reusable Components
......................................................................................................................................................
......................................................................................................................................................
11-8 Oracle iDS Forms: Build Internet Applications II
Reusable Components List
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-9
Lesson 11: Using Reusable Components
......................................................................................................................................................
Creating a Calendar
To create a calendar:
1. Copy or make the Calendar Object
Group a subclass.
2. Attach the PL/SQL library
CALENDAR.PLL.
3. Create a Key-Listval trigger.
4. Call Date_LOV.Get_Date.
......................................................................................................................................................
11-10 Oracle iDS Forms: Build Internet Applications II
The Calendar Class
......................................................................................................................................................
Creating a Calendar
To create a calendar, follow the steps below:
1 Open the stndrd20.olb object library. From the Components page,
copy or subclass the Calendar object group.
2 Attach the PL/SQL library calendar.pll, which contains the
Date_LOV package, to your module.
3 Create a Key-Listval trigger on the date item for which you would like to
use the Date List of Values window. Add code to display the calendar
using the Date_LOV package.
4 If you want the end user to be able to close the Date List of Values
window by clicking the WindowClose button in the title bar, create a
form-level When-Window-Closed trigger.
The calendar appears whenever the end user invokes a list of values for the
date item. A single calendar can be reused on many different date items.
Simply create a Key-Listval trigger for each item.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-11
Lesson 11: Using Reusable Components
......................................................................................................................................................
......................................................................................................................................................
11-12 Oracle iDS Forms: Build Internet Applications II
Calendar Object Group Content
......................................................................................................................................................
The Blocks
The calendar object contains two blocks:
Date_Control_Block: This block contains the buttons that control which
month and year is displayed.
Date_Button_Block: This block contains the buttons that represent each
day of the month.
The Canvas
The calendar class contains a content canvas named Date_Lov_Canvas. This
canvas contains all the items from both blocks.
The Window
The calendar class contains a window named Date_Lov_Window. This
window is used to display the Date_Lov_Canvas.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-13
Lesson 11: Using Reusable Components
......................................................................................................................................................
Example
date_lov.get_date(sysdate,s_ord.date_ordered,240
date_lov.get_date(sysdate,s_ord.date_ordered,240
,60,Order
,60,Order Date,OK,Cancel,TRUE,FALSE,FALSE);
Date,OK,Cancel,TRUE,FALSE,FALSE);
......................................................................................................................................................
11-14 Oracle iDS Forms: Build Internet Applications II
Built-in for Manipulating the Calendar
......................................................................................................................................................
Date_LOV.Get_Date Procedure
This procedure displays the calendar with the month and year specified in
the Display_Date argument. The day of the month is displayed with bold
numbers. The date chosen by the end user is returned to the item specified
by the Return_Item argument.
. . .
PROCEDURE Date_LOV.Get_Date(
display_date DATE, return_item VARCHAR2,
v_x_pos NUMBER := 0, v_y_pos NUMBER := 0,
v_title VARCHAR2 := Date List of Values,
v_ok VARCHAR2 := OK,
v_cancel VARCHAR2 := Cancel, v_highlight BOOLEAN := TRUE,
v_autoconfirm BOOLEAN := TRUE, v_autoskip BOOLEAN := FALSE );. . .
Argument Description
display_date The date to display when the Date List of Values window first
appears
return_item The name of the block and item to which to return the chosen date
v_x_pos Specifies the X coordinate of the Date List of Values window
v_y_pos Specifies the Y coordinate of the Date List of Values window
v_title Title to display in the Date List of Values window
v_ok Label for the OK button
v_cancel Label for the Cancel button
v_highlight Specifies that weekend days appear in a different color
v_autoconfirm Specifies that the date immediately be returned when the end user
clicks a day
v_autoskip Specifies that the input focus moves to the next item in sequence
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-15
Lesson 11: Using Reusable Components
......................................................................................................................................................
Summary
......................................................................................................................................................
11-16 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Reusable Components
The purpose of a reusable component
Reusable components list
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-17
Lesson 11: Using Reusable Components
......................................................................................................................................................
Practice 11 Overview
......................................................................................................................................................
11-18 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 11
......................................................................................................................................................
Practice Contents
Create a picklist to display and select the products available.
Add a calendar on the S_ORD.DATE_ORDERED and
S_ORD.DATE_SHIPPED items.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-19
Lesson 11: Using Reusable Components
......................................................................................................................................................
Practice 11
1 Create a picklist by using the picklist class. This picklist enables the end
user to select order items from a product list, and to place selections in a
second list.
a Create a new form module, called PICKXX where XX is your student
course number. Open the Form_Builder_II.olb object
library. This library contains form objects and code for the picklist.
Copy the PICKLIST_BASIC object group to your form module.
Copy the PICKLIST object group into your new form module.
b Ensure the CONTROL block is the last defined data block in the
Object Navigator.
c Attach the picklist.pll library. This contains the functions
and procedures required for creating the picklist.
d Define a When-New-Form-Instance trigger which will create and
populate the picklist. You can import the code from the
pr11_1.txt file.
Create the picklist with the picklist.Create_Picklist procedure.
Call function pick_list.Populate_Picklist_With_Query to populate
the List_in object. You must define a query that returns the ID, name
and suggested prices from the S_PRODUCT table.
Call pick_list.Set_Picklist_Selection procedure to select the first
element in the list.
Display both lists by using the pick_list.Display_Picklist procedure.
Exclude from the query any products already in the current S_ITEM
block. You should use the global variable :GLOBAL.where_cls.
e Save and compile your form. Deploy your form to the Web.
f In your ORDERS form, modify the When-Button-Pressed trigger for
the CONTROL.PRODUCT_LOV_BUTTON so that it calls your
new form module.
g Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
11-20 Oracle iDS Forms: Build Internet Applications II
Practice 11
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 11-21
Lesson 11: Using Reusable Components
......................................................................................................................................................
......................................................................................................................................................
11-22 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
12-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson you will learn how to enhance Web-deployed forms by using
JavaBeans to customize the user interface. You will also learn about
Oracle8i features that may be used within Web-deployed Oracle forms.
Objectives
After completing this lesson, you should be able to do the following:
Customize the user interface
Incorporate JavaBeans in Web-deployed forms by
- Inserting Pluggable Java Components
- Creating Bean Areas
Exploit Oracle8i features with Web-deployed forms
Invoke the Java Importer Tool
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-3
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-4 Oracle iDS Forms: Build Internet Applications II
Java and Oracle Forms Developer
......................................................................................................................................................
Forms Applet
The Forms Applet is a Java code component embedded in the base HTML
file. It is responsible for downloading and executing the Java class files that
create the Oracle Forms Developer user interface.
JavaBeans
JavaBeans are portable, reusable and platform independent Java programs.
You can change the appearance and behavior of the Forms user interface by
including JavaBeans in your Oracle Form Builder applications.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-5
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Oracle Look
and Feel
Bean
Areas
Pluggable Java
Components
......................................................................................................................................................
12-6 Oracle iDS Forms: Build Internet Applications II
Java in Web-Deployed Forms
......................................................................................................................................................
JavaBeans
You can add JavaBeans to extend existing Oracle Form Developer
components using Pluggable Java Components. With Bean Areas you can
insert JavaBeans that provide new application functionality, and may also be
used to execute code on the user interface.
Bean Areas
You can insert new functionality, such as slider controls or progress bars, by
defining a Bean Area Item in your form module. With supplied triggers and
PL/SQL built-ins, you can communicate between the Form Server and the
client JavaBean.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-7
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-8 Oracle iDS Forms: Build Internet Applications II
The Forms Applet
......................................................................................................................................................
Technical Note
To enable the Web Previewer, you must have installed the Forms Server
Runtime Engine in your test environment.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-9
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Defining Fonts
for Web-Deployed Forms
......................................................................................................................................................
12-10 Oracle iDS Forms: Build Internet Applications II
Defining Fonts for Web-Deployed Forms
......................................................................................................................................................
At run time, Oracle Form Developer fonts are converted to their Java
equivalent using a reference to an alias file, Registry.dat. If your
selected Oracle Form Builder font does not map to a supported Java font, it
will be replaced with the default Java font. You can specify the default Java
font by editing the Java registry file. The Registry.dat file is located
in:
ORACLE_HOME/forms60/java/oracle/forms/registry/
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-11
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-12 Oracle iDS Forms: Build Internet Applications II
Pluggable Java Components
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-13
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Text Items:
Checkboxes:
Y N
Smoking ?
Radio Buttons
Cash
Credit Card
Cheque
Name: PasswordFieldPJC.class
Path :
FORMS60_JAVADIR oracle\forms\demos
......................................................................................................................................................
12-14 Oracle iDS Forms: Build Internet Applications II
Pluggable Java Components
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-15
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Bean Areas
......................................................................................................................................................
12-16 Oracle iDS Forms: Build Internet Applications II
What Is a Bean Area?
......................................................................................................................................................
With PL/SQL built-ins and triggers, you can also communicate with the
JavaBean at run time.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-17
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Hosting a JavaBean
3. JavaBean is visible in
Layout Editor
......................................................................................................................................................
12-18 Oracle iDS Forms: Build Internet Applications II
Hosting a JavaBean
......................................................................................................................................................
Hosting a JavaBean
You can host a JavaBean in your Oracle Forms Developer application by
creating a Bean area control item.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-19
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
When-Custom-Item-Event trigger
System variables:
:SYSTEM.CUSTOM_ITEM_EVENT
:SYSTEM.CUSTOM_ITEM_EVENT_PARAMETERS
......................................................................................................................................................
12-20 Oracle iDS Forms: Build Internet Applications II
How a JavaBean Communicates
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-21
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
SET_CUSTOM_PROPERTY built-in
Example:
Declare
EventName varchar2(20) := :system.custom_item_event;
EventValues ParamList;
EventvalueType number;
TempString varchar2(4000);
Begin
If EventName = ALARMFIRED then
EventValues := get_parameter_list(:system.custom_event_parameters);
get_parameter_attr(EventValues, ALARMTIME, EventvalueType,
TempString);
If Summit_Show_Alert(Alarm Call:||TempString) =
alert_button1 then
set_custom_property(jAlarmClock, 1, wakeuptime, 1000);
end if;
end if;
End;
......................................................................................................................................................
12-22 Oracle iDS Forms: Build Internet Applications II
Communicating with the JavaBean
......................................................................................................................................................
Example
SET_CUSTOM_PROPERTY(alarm_clock,1, wakeuptime, 1000);
In the following example the When-Custom-Item-Event trigger examines
the system variables to identify the contents of a parameter list sent by the
JavaBean. The JavaBean has sent date and time information to the form,
which is then displayed to the user using an alert.
Declare
EventName varchar2(20) := :system.custom_item_event;
EventValues ParamList;
Eventvalue Typenumber;
TempString varchar2(4000);
Begin
If EventName = ALARMFIRED' then
EventValues := get_parameter_list(
:system.custom_event_parameters);
get_parameter_attr(EventValues, 'ALARMTIME',
EventvalueType, TempString);
If Summit_Show_Alert(Alarm Call: '||TempString) =
alert_button1 then
set_custom_property(AlarmClock',
1,wakeuptime', 1000);
end if;
end if;
End;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-23
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-24 Oracle iDS Forms: Build Internet Applications II
Exploiting Oracle8i Features
......................................................................................................................................................
Enterprise JavaBeans
Unlike JavaBeans, Enterprise JavaBeans (EJB) do not perform user
interface functions. EJB encapsulate and distribute Java backend logic
across many servers in order to manage data, transaction security, and
resources.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-25
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-26 Oracle iDS Forms: Build Internet Applications II
How to Create JavaBeans
......................................................................................................................................................
Technical Note
You should only deploy light-weight JavaBeans with your Web-deployed
forms applications; the light-weight JavaBean user interface (UI)
components are rendered completely and can be used independently of any
operating system. In contrast, heavy-weight JavaBeans rely on UI objects
provided by the client operating system. Oracle Forms Developer uses light-
weight JavaBeans to provide a common look and feel across different
operating systems.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-27
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
......................................................................................................................................................
12-28 Oracle iDS Forms: Build Internet Applications II
The Java Importer
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-29
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
4 5
......................................................................................................................................................
12-30 Oracle iDS Forms: Build Internet Applications II
The Java Importer Tool
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-31
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Summary
......................................................................................................................................................
12-32 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Customize the User Interface
Specifying Oracle look and feel
Specifying default Java fonts
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-33
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Practice 12 Overview
......................................................................................................................................................
12-34 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 12
......................................................................................................................................................
Practice Contents
Provide an alternative UI for text items by including PJC
- Change the mouse cursor style
- Display secure data as asterisks.
Add a Java Bean to allow users to specify hyperlinks of their choice.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 12-35
Lesson 12: Using Java with Web-Deployed Forms
......................................................................................................................................................
Practice 12
1 Provide an alternative user interface for your Web-deployed forms by
including Pluggable Java Components (PJCs).
a Open the JAVAEMP.fmb form module. Save as JAVAXX.fmb,
where XX is your student course code.
b Change the :EMP.SAL item so that values are displayed as asterisks
at run time. Use the PJC PasswordFieldPJC.class.
This class file is held in the folder:
FORMS60_JAVADIR /oracle/forms/demos
c Change the :EMP.ENAME item so that the mouse cursor changes to
hand style whenever the cursor is moved over the item. Use the
PJC ModCursor.class.
This class file is held in the folder:
FORMS60_JAVADIR /oracle/forms/demos
d Use the built-in SET_CUSTOM_PROPERTY in an appropriate
trigger, to specify the cursor style:
SET_CUSTOM_PROPERTY(Emp.Ename,1,
DOCURSOR,HAND);
e Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
12-36 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
13-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson covers the use of Oracle database server features in Form
Builder applications. You will learn about storing and calling PL/SQL code,
handling Oracle database server errors, and issuing DDL commands from
within forms.
Objectives
After completing this lesson, you should be able to do the following:
Use Oracle database server functionalities in forms
Deal with server-side PL/SQL
Recognize which PL/SQL8 features are supported in forms
Handle Oracle database server errors
Perform DDL commands by using the FORMS _DDL built-in
subprograms
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-3
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-4 Oracle iDS Forms: Build Internet Applications II
Using Oracle Database Server Functionality in Forms
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-5
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-6 Oracle iDS Forms: Build Internet Applications II
Dealing with PL/SQL Code
......................................................................................................................................................
Application Partitioning
For enhanced performance, you may want to call or store PL/SQL code on
either the Oracle database server or the Oracle Form Builder application.
In Form Builder you can drag and drop PL/SQL program units between the
Oracle database server and the application. This is called application
partitioning. With Web-deployed forms it is also possible to place code on
the client by using JavaBeans. In this way, you can optimally divide
application code over the available resources.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-7
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-8 Oracle iDS Forms: Build Internet Applications II
PL/SQL8 Support
......................................................................................................................................................
PL/SQL8 Support
Oracle Forms Developer uses PL/SQL8 in the Oracle database server and
the Oracle Form Builder application. However, Form Builder module
program units currently cannot support Oracle8i object-related functionality.
The Stored Program Unit editor has been extended in Oracle Forms
Developer to allow editing of the type body (methods) and type
specification (attributes) of Oracle8i user-defined data types.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-9
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-10 Oracle iDS Forms: Build Internet Applications II
PL/SQL8 Scalar Data Types
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-11
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Unsupported Client-Side
PL/SQL8 Features
......................................................................................................................................................
13-12 Oracle iDS Forms: Build Internet Applications II
Unsupported Oracle Forms Developer PL/SQL8 Features
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-13
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Database
Trigger/PU
trigger
Explicit DML
Stored
Stored PU call program unit
......................................................................................................................................................
13-14 Oracle iDS Forms: Build Internet Applications II
Handling Errors Raised by the Oracle Database Server
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-15
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-16 Oracle iDS Forms: Build Internet Applications II
Handling Errors Raised by the Oracle Database Server
......................................................................................................................................................
Technical Note
The values of DBMS_ERROR_CODE and DBMS_ERROR_TEXT are the
same as what a user would see after selecting [Display Error]; the values are
not automatically reset following successful execution.
Appendix F Handling Server-Side Errors covers server-side error
handling in more detail.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-17
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Characteristics:
Statement cannot return results directly
Use FORM_SUCCESS to check
success of statement
Hints:
Create SQL Query record group
instead of FORMS_DDL
Call stored program unit instead of
FORMS_DDL
......................................................................................................................................................
13-18 Oracle iDS Forms: Build Internet Applications II
Performing DDL with FORMS_DDL
......................................................................................................................................................
Syntax
FORMS_DDL(statement);
Description
FORMS_DDL issues dynamic SQL statements at run time, including
server-side PL/SQL and DDL.
Parameter
The specified statement can be any string expression up to 32K
representing a:
PL/SQL block
DML statement
DDL statement
Do not end the PL/SQL block with a slash or the DML or DDL statement
with a semicolon.
Characteristics
FORMS_DDL is an unrestricted procedure that is also valid in Enter Query
mode.
The specified statement must not contain bind-variable references.
However, you can concatenate the values of bind variables into the
specified string.
The statement executed using FORMS_DDL cannot return results to
Forms directly.
Use the FORM_SUCCESS built-in to check whether the statement
issued using FORMS_DDL executed correctly.
Note: Consider using a query record group with a SELECT statement or
calling a stored program unit, instead of executing FORMS_DDL.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-19
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
......................................................................................................................................................
13-20 Oracle iDS Forms: Build Internet Applications II
Using FORMS_DDL
......................................................................................................................................................
Using FORMS_DDL
The following examples show how you can use the FORMS_DDL built-in
function.
Example
Create a temporary table at the start of a post.
Pre-commit trigger at form level:
BEGIN
FORMS_DDL(CREATE table temp(n_col number));
IF not FORM_SUCCESS THEN
MESSAGE (Table creation failed.);
RAISE form_trigger_failure;
END IF;
END;
Example
Execute a procedure with a given name. This is useful if you want to determine
dynamically which procedure should be executed in a certain situation.
PROCEDURE exec_proc (p_proc_name IN VARCHAR2)
IS
BEGIN
FORMS_DDL(BEGIN || p_proc_name ||; END;);
IF not FORMS_SUCCESS THEN
handle_server_error(DBMS_ERROR_CODE,DBMS_ERROR_TEXT);
END IF;
END;
Note: If the FORMS_DDL built-in fails, Forms sets the DBMS_ERROR_CODE
and DBMS_ERROR_TEXT built-ins. Therefore, you can handle Oracle server
errors using the HANDLE_SERVER_ERROR procedure discussed earlier.
Always test the SYSTEM.FORM_STATUS before calling the FORMS_DDL
built-in.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-21
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Summary
......................................................................................................................................................
13-22 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Oracle Database Server Features Useful for Form Builder
Declarative integrity constraints
Stored program units
Database triggers
DDL
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-23
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Practice 13 Overview
......................................................................................................................................................
13-24 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 13
......................................................................................................................................................
Practice Contents
Handle errors caused by stored program units.
Handle errors caused by declarative-constraint violations.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 13-25
Lesson 13: Using Server Features in Form Builder
......................................................................................................................................................
Practice 13
1 Create a stored procedure, and process error messages that it may
generate in the CUSTSERVER form.
a Open the CUSTSERVER form and save as CUSTSERVXX where
XX is your student course number. Copy the code in the
SELECT_CODE program unit and create a stored procedure called
SELECT_CUSTOMER. This procedure takes a user supplied value
from :CONTROL.NAME to check whether a customer name already
exists. Existing names will generate an error.
b Modify the When-Button-Pressed trigger for the CONTROL block
CHECK_CUSTOMER button, to trap any errors generated from the
stored procedure SELECT_CUSTOMER. If a customer already
exists, display a warning message to the user.
c Save and compile your form module; test.
......................................................................................................................................................
13-26 Oracle iDS Forms: Build Internet Applications II
................................
Applying Timers
Lesson 14: Applying Timers
......................................................................................................................................................
Objectives
......................................................................................................................................................
14-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson covers time-initiated processing; that is, processing that occurs
after a certain amount of time has elapsed. The mechanism you use to do this
is called a timer and it is created, modified, and deleted at run time.
Objectives
After completing this lesson, you should be able to do the following:
Describe timers
Create a timer
Modify a timer
Delete a timer
Handle timer expiration
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-3
Lesson 14: Applying Timers
......................................................................................................................................................
Timers
What is a timer?
Built-ins for timers:
FIND_TIMER
CREATE_TIMER
SET_TIMER
DELETE_TIMER
GET_APPLICATION_PROPERTY
(TIMER_NAME)
Timers
When-Timer-Expired trigger
Using timers:
Poll database
Periodically query, commit, or rollback
Show About information at startup
Technical Note
Timers are not suitable means of shutting down an application. It is the job
of the operating system to recognize idle processes and shut them down.
......................................................................................................................................................
14-4 Oracle iDS Forms: Build Internet Applications II
Timers
......................................................................................................................................................
Timers
Forms typically processes events that are user initiated. You can use timers
when you want Forms to initiate actions after a specific time period time.
What Is a Timer?
A timer is a programmatic construct similar to an internal alarm clock.
You can create, modify, or delete timers with built-ins. When you create or
modify a timer, you can specify the time period for the timer. Using a
trigger, you can specify actions to be performed at the end of that period.
When-Timer-Expired Trigger
This trigger fires when the specified time interval of the timer has elapsed.
Uses of Timers
Polling the database to check if a certain event has occurred
Performing an automatic query at regular intervals
Showing About this... information at form startup
Performing automatic commits or rollbacks after a specified idle time
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-5
Lesson 14: Applying Timers
......................................................................................................................................................
Timer A B,A
expired
Query
complete
(R) When-Timer-Expired (B)
When-Timer-Expired (A)
......................................................................................................................................................
14-6 Oracle iDS Forms: Build Internet Applications II
Handling Timer Expiration
......................................................................................................................................................
Timer Queue
When a timer expires, it is put in a queue of expired timers. Forms services
this timer queue on a first-in-first-out basis, but only while it is waiting for
user actions. After an expired timer is handled, it is removed from the queue.
Note: A repeating timer will not begin the next iteration while it is still in
the timer queue.
When-Timer-Expired Trigger
When using the When-Timer-Expired trigger remember that it:
Fires once for each timer that expires, but only after Form Builder has
completed any current processing of triggers and built-in functions
Fires after the specified time interval, rather than exactly on the moment
of expiration
Must be defined at the form level
Should include the GET_APPLICATION_PROPERTY built-in function
for you to find out which timer has expired
Example
Handle the expiration of two timers named HOUR_ALARM and
ABOUT_STARTUP.
DECLARE
v_timer_name VARCHAR2(30);
BEGIN
v_timer_name := GET_APPLICATION_PROPERTY(timer_name);
IF v_timer_name = HOUR_ALARM THEN
MESSAGE(One hour has passed again.);
ELSIF v_timer_name = ABOUT_STARTUP THEN
DELETE_TIMER(ABOUT_STARTUP);
END IF;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-7
Lesson 14: Applying Timers
......................................................................................................................................................
Creating a Timer
Syntax:
CREATE_TIMER
CREATE_TIMER (timer_name,
(timer_name, milliseconds,
milliseconds, iterate)
iterate)
Example:
v_timer_id
v_timer_id := CREATE_TIMER ((hour_alarm,
:= CREATE_TIMER hour_alarm, cst_hour);
cst_hour);
......................................................................................................................................................
14-8 Oracle iDS Forms: Build Internet Applications II
Creating a Timer
......................................................................................................................................................
Creating a Timer
You can create a timer by using the CREATE_TIMER built-in function,
which returns type TIMER.
Syntax
Parameter Description
timer_name The timer name
milliseconds The duration of the timer in milliseconds (Value must be
between 1 and 2147483648, approximately 25 days.)
iterate Specifies whether the timer should repeat upon expiration
(Valid values are REPEATthe defaultand NO_REPEAT.)
Example
At form startup, create a timer named HOUR_ALARM that expires every
hour.
DECLARE
cst_hour constant NUMBER(7) := 3600000;
--3600000 is one hour in milliseconds
v_timer_id TIMER;
BEGIN
v_timer_id := CREATE_TIMER(hour_alarm, cst_hour);
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-9
Lesson 14: Applying Timers
......................................................................................................................................................
Modifying a Timer
Syntax:
SET_TIMER
SET_TIMER (timer_name,
(timer_name, milliseconds,
milliseconds, iterate)
iterate)
SET_TIMER
SET_TIMER (timer_id, iterate))
(timer_id, milliseconds, iterate
milliseconds,
Example:
SET_TIMER ((hour_alarm,
SET_TIMER hour_alarm, no_change, no_repeat);
no_change, no_repeat );
......................................................................................................................................................
14-10 Oracle iDS Forms: Build Internet Applications II
Modifying a Timer
......................................................................................................................................................
Modifying a Timer
You can modify a timer by using the SET_TIMER built-in procedure.
Syntax
Parameter Description
timer_name The timer name
timer_id The internal timer ID
millisec- The duration of the timer in milliseconds (Value must be between 1 and
onds 2147483648approximately 25 daysor must be NO_CHANGE.)
iterate Specifies whether the timer should repeat upon expiration (Valid
values are REPEAT (default), NO_REPEAT, and NO_CHANGE.)
Example
Set the repeat behavior of a timer named HOUR_ALARM without changing
the time interval. The trigger name depends on the situation.
BEGIN
SET_TIMER(hour_alarm, no_change, no_repeat);
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-11
Lesson 14: Applying Timers
......................................................................................................................................................
Deleting a Timer
Syntax:
DELETE_TIMER
DELETE_TIMER (timer_name)
(timer_name)
DELETE_TIMER
DELETE_TIMER (timer_id)
(timer_id)
Example:
...
...
IF
IF NOT
NOT ID_NULL (FIND_TIMER ((hour_alarm
ID_NULL (FIND_TIMER hour_alarm))
)) THEN
THEN
DELETE_TIMER (hour_alarm);
DELETE_TIMER (hour_alarm);
END
END IF;
IF;
...
...
......................................................................................................................................................
14-12 Oracle iDS Forms: Build Internet Applications II
Deleting a Timer
......................................................................................................................................................
Deleting a Timer
You can delete a timer by using the DELETE_TIMER built-in procedure.
Syntax
DELETE_TIMER(timer_name)
DELETE_TIMER(timer_id)
Parameter Description
timer_name The timer name
timer_id The internal timer ID
Example
Delete a timer named HOUR_ALARM after first checking that it exists. The
trigger name depends on the situation.
BEGIN
IF NOT ID_NULL(FIND_TIMER(hour_alarm)) THEN
DELETE_TIMER(hour_alarm);
END IF;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-13
Lesson 14: Applying Timers
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
14-14 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
A timer is a programmatic construct much like an internal alarm clock.
Uses of Timers
Polling the database to check if a certain event has occurred
Performing an automatic query at regular intervals
Showing About this... information at form startup
Performing an automatic commit or rollback after a specific amount of
idle time
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-15
Lesson 14: Applying Timers
......................................................................................................................................................
Practice 14 Overview
......................................................................................................................................................
14-16 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 14
......................................................................................................................................................
Practice Contents
If table rows are locked, display an alert that asks the user to commit or roll
back changes after a set period of time.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 14-17
Lesson 14: Applying Timers
......................................................................................................................................................
Practice 14
1 Automatically ask the users if they want to commit after a set period of
time.
a Open your CUSTOMERS form module.
b At the startup of the form, create a global variable called
GLOBAL.LOCKS_PENDING. This will indicate at all times
whether rows of the S_CUSTOMER table are locked. The default
value is NULL. Append your new code to existing code.
c Create the On-Lock trigger to implement the default lock processing,
update the global variable, and create the timer. You can import the
code from the pr14_1.txt file.
d Display an alert if locks are still pending after a certain period of
time elapses. This alert should ask the user to commit or roll back the
changes. The alert, ASK_SAVE, already exists in your form. Define
an appropriate trigger. You can import the code from the
pr14_2.txt file.
e Create a Post-Database-Commit trigger to restore the NULL value to
the global variable. You can import the code from the pr14_3.txt
file.
f Create the On-Rollback trigger to implement the default rollback
processing and restore the NULL value to the global variable. You
can import the code from the pr14_4.txt file.
g Save and compile your form to test.
......................................................................................................................................................
14-18 Oracle iDS Forms: Build Internet Applications II
................................
Including Charts
and Reports
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Objectives
......................................................................................................................................................
15-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn how to include charts and reports in your
application. You will also learn how to invoke additional document types
with Web-deployed forms.
Objectives
After completing this lesson, you should be able to do the following:
Include charts in an application
Include reports in an application
Integrate other documents with Web-deployed forms
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-3
Lesson 15: Including Charts and Reports
......................................................................................................................................................
......................................................................................................................................................
15-4 Oracle iDS Forms: Build Internet Applications II
Including Charts by Using the Chart Wizard
......................................................................................................................................................
Incorporating a Chart
The steps to create a chart are:
1 Specify a chart type and subtype.
2 Specify the data block that contains the data you want to assign to chart
columns.
3 Specify the data to appear on the Category (X) axis of the chart.
4 Specify the data to appear on the Value (Y) axis of the chart.
Follow the prompts on each page of the wizard to specify the settings for the
chart you want to create.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-5
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Chart
type
......................................................................................................................................................
15-6 Oracle iDS Forms: Build Internet Applications II
Including Charts by Using the Chart Wizard
......................................................................................................................................................
Chart Type
Select the style of chart that you require. The picture on the left of the wizard
displays the relevant chart style.
The chart subtype options are context-sensitive; the number and style of
options change depending on the chart type that you choose. Select the chart
subtype that you require, and then click Next to continue to the next wizard
page.
Data Source
The next step in the Chart Wizard is to select the block that contains the data
you want to represent in the chart. The data block you select determines the
data that is available for assignment to the Category and Value axes of your
chart.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-7
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Arrow points to
the Value axis.
......................................................................................................................................................
15-8 Oracle iDS Forms: Build Internet Applications II
Including Charts by Using the Chart Wizard
......................................................................................................................................................
Category Axis
To use the Chart Wizard to map data to your charts Category (X) axis:
1 In the Available Fields list, select the field that you want to map to the
Category (X) axis of the chart.
2 Transfer the selected field from the Available Fields list to the Category
Axis list.
Value Axis
To use the Chart Wizard to map data to your charts Value (Y) axis:
1 In the Available Fields list, select the field that you want to map to the
Value (Y) axis of the chart.
2 Transfer the selected field from the Available Fields list to the Value
Axis list.
You must transfer at least one field from the Available Fields list to the
Category Value list before navigating to the next page.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-9
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Filename
Execution Mode
Communication Mode
Data Source Data Block
Query Name
Data Source X Axis
Data Source Y Axis
Update on Query
Update on Commit
......................................................................................................................................................
15-10 Oracle iDS Forms: Build Internet Applications II
Chart Item Properties
......................................................................................................................................................
Property Description
Filename Specifies the name of the file where the chart is stored
Execution Mode Specifies the execution version of Graphics Builder to use:
BATCH or RUNTIME
Communication Mode Specifies the communication mode to be used when calling
Graphics Builder: SYNCHRONOUS or ASYNCHRONOUS
Data Source Data Block Specifies the block that contains the data to represent in the chart
Query Name Specifies the name of the query used to display the chart
Data Source X Axis Specifies the item name used to map data to the chart Category
(X) axis
Data Source Y Axis Specifies the item name used to map data to the chart Value (Y)
axis
Update on Query Specifies that the chart is refreshed each time you perform a
query
Update on Commit Specifies that the chart is refreshed each time you perform a
commit
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-11
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Technical Note
Passing data is applicable only if running against a local server.
......................................................................................................................................................
15-12 Oracle iDS Forms: Build Internet Applications II
Reporting Within Form Builder
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-13
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Filename
Filename
Execution
Execution Mode
Mode
Communication
Communication Mode
Mode
Data
Data Source
Source Data
Data Block
Block
Query
Query Name
Name
Reports properties
......................................................................................................................................................
15-14 Oracle iDS Forms: Build Internet Applications II
Report Object Properties
......................................................................................................................................................
Reports Properties
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-15
Lesson 15: Including Charts and Reports
......................................................................................................................................................
......................................................................................................................................................
15-16 Oracle iDS Forms: Build Internet Applications II
Working with Reports
......................................................................................................................................................
Built-in Description
RUN_REPORT_OBJECT Runs a specified report on a specified server
FIND_REPORT_OBJECT Returns the internal ID of a report object
GET_REPORT_OBJECT_PROPERTY Dynamically gets report object properties at
run time
SET_REPORT_OBJECT_PROPERTY Dynamically sets report object properties at
run time
CANCEL_REPORT_OBJECT Cancels a report in the server queue
COPY_REPORT_OUTPUT Copies the report output back to the client
REPORT_OBJECT_STATUS Returns the current status of a report (The status
codes can be FINISHED, RUNNING,
CANCELED, OPENING_REPORT,
ENQUEUED, INVALID_JOB,
TERMINATED_WITH_ERROR, or
CRASHED.)
RUN_PRODUCT Invokes one of the supported Oracle tools
products and specifies the name of the module or
modules to be run
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-17
Lesson 15: Including Charts and Reports
......................................................................................................................................................
DECLARE
v_rep VARCHAR2(100);
repid REPORT_OBJECT;
BEGIN
repid := FIND_REPORT_OBJECT(deptrpt);
v_rep := RUN_REPORT_OBJECT(repid);
end;
. . .
repid := FIND_REPORT_OBJECT(barcode);
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
IF rep_status = FINISHED THEN
COPY_REPORT_OBJECT_OUTPUT(v_rep,c:\local.pdf);
HOST(netscape c:\local.pdf);
END IF;
. . .
......................................................................................................................................................
15-18 Oracle iDS Forms: Build Internet Applications II
Working with Reports
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-19
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Example
my_url
my_url :=
:= http://www.summit.com/repts/emps.pdf;
http://www.summit.com/repts/emps.pdf;
WEB.SHOW_DOCUMENT(my_url,
WEB.SHOW_DOCUMENT(my_url, _SELF);
_SELF);
......................................................................................................................................................
15-20 Oracle iDS Forms: Build Internet Applications II
Working with Reports
......................................................................................................................................................
Property Value
Report Destination Format File
Report Destination Name pathname / report filename
Report Destination Format HTML
HTMLCSS
PDF
XML
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-21
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
15-22 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
In this lesson, you should have learned how to include charts and reports in
your application. You should have learned how to invoke the Chart Wizard.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-23
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Practice 15 Overview
......................................................................................................................................................
15-24 Oracle iDS Forms: Build Internet Applications II
Practice Overview: Lesson 15
......................................................................................................................................................
Practice Contents
Create a chart to display the total orders for each customer.
Create a report based on the S_CUSTOMER block.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-25
Lesson 15: Including Charts and Reports
......................................................................................................................................................
Practice 15
1 Create a chart object by using the Chart Wizard. This chart should
display the total orders for each customer.
a Open the ORDCHART form module. Save as ORDCHARTXX
where XX is your student course number. This form module contains
a S_ORD block. Only one item from this block is visible: TITLE.
This item displays a title for your chart.
b In the Layout Editor, use the Chart tool to drag a chart area onto the
canvas. Select Use the Chart Wizard from the New Chart Object
dialog box. Do not specify a title for the chart.
c Select Column as chart type, Plain as chart subtype.
d Specify the S_ORD block as the data block that contains the data
you want to assign to chart columns.
e Select CUSTOMER_NAME to appear on the Category (X) axis, and
TOTAL to appear on the Value (Y) axis of the chart.
f Click the Finish button.
g Save and compile your form module. Deploy your form to the Web
to test. To display the chart, click in the Title item on the Chart tab.
......................................................................................................................................................
15-26 Oracle iDS Forms: Build Internet Applications II
Practice 15
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 15-27
Lesson 15: Including Charts and Reports
......................................................................................................................................................
......................................................................................................................................................
15-28 Oracle iDS Forms: Build Internet Applications II
................................
Practice Solutions
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 1 Solutions
1 Create a new menu module.
a Using the following screenshot as a guideline, create a new menu
module called M_SUMMITXX where XX is your student course
number.
- Select the Menus node in the Object Navigator and click the
Create tool.
- Invoke the Menu Editor.
- This automatically creates the main menu.
- Change the name of the menu to MAIN_MENU.
- Rename the menu item New Item to File. Click New Item twice
to obtain the text cursor. Erase the old name. Enter the name
File.
- Create new menu items under File. Click File. Click the Create
Down tool. Change the name.
......................................................................................................................................................
A-2 Oracle iDS Forms: Build Internet Applications II
Practice 1 Solutions
......................................................................................................................................................
Visible in
Menu Visible Horiz.
Item Command Menu Item in Menu Icon
Label Type Type Code Menu Toolbar Filename
Save Plain PL/SQL DO_KEY(CO Yes Yes Save
MMIT_FORM
);
Clear Plain PL/SQL DO_KEY( Yes Yes Abort
CLEAR_FORM
);
Null1 Separator Null Yes Yes
Exit Plain PL/SQL DO_KEY( Yes Yes Exit
EXIT_FORM
);
Null2 Separator Null No Yes
- Note the exact names of the Main Menu, and each of its menu
items. These will be needed in a later exercise.
- Create a new menu item to the right of File and rename it Edit.
- Click the File menu item.
- Click the Create Right tool.
- Name the new menu item Edit.
- Create new menu items under Edit. Click Edit. Click the Create
Down tool. Change the name.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-3
Appendix A: Practice Solutions
......................................................................................................................................................
Visible in
Menu Magic Command Visible Horiz. Menu Icon
Label Item Type Item Type in Menu Toolbar Filename
Cut Magic Cut Null Yes Yes Cut
Copy Magic Copy Null Yes Yes Copy
Paste Magic Paste Null Yes Yes Paste
Null3 Separator Null No Yes
- Create a new menu item to the right of Edit and rename it Sort
By. Click Edit. Click the Create Right tool. Rename the new
menu item Sort By.
- Create three new menu items under Sort By. Click Sort By. Click
the Create Down tool. Change the name. Set additional
properties as follows:
Sort By Menu
......................................................................................................................................................
A-4 Oracle iDS Forms: Build Internet Applications II
Practice 1 Solutions
......................................................................................................................................................
Visible in
Menu Command Horiz. Menu Icon
Label Item Type Type Menu Item Code Toolbar Filename
Enter Plain PL/SQL DO_KEY( Yes query
Query ENTER_QUERY);
eXe- Plain PL/SQL DO_KEY(EXECUT Yes execute
cute E_QUERY);
Query
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-5
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 2 Solutions
1 Define a check menu item.
a Open your M_SUMMIT menu module and add a new menu item to
the Sort By menu; name it Display_Help.
- See previous solution.
- Set the properties as follows:
......................................................................................................................................................
A-6 Oracle iDS Forms: Build Internet Applications II
Practice 2 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-7
Appendix A: Practice Solutions
......................................................................................................................................................
4 With both the ORDERS and CUSTOMERS form modules, restore the default
menu, (DEFAULT&SMARTBAR).
......................................................................................................................................................
A-8 Oracle iDS Forms: Build Internet Applications II
Practice 3 Solutions
......................................................................................................................................................
Practice 3 Solutions
1 Maintain consistent functionality in your form module by using key
triggers. Define a key trigger in your ORDERS form to give users
consistent functionality whenever they exit the form, either using the
menu or when the CONTROL.EXIT_BUTTON button is pressed.
a Redefine [Exit Form] in your ORDERS form so that an alert
message is displayed to users before allowing them to exit the form.
b Amend the entry in Keyboard Help to Exit Orders for the key
trigger.
c Save and compile your form. Deploy your form to the Web to test.
- Create a form-level KEY-EXIT trigger. Copy the code from the
CONTROL.EXIT_BUTTON When-button-pressed trigger.
Set_Alert_Property(Exit_Alert,
ALERT_MESSAGE_TEXT,
Do you really want to leave the form?);
If show_alert(EXIT_ALERT) = alert_button1
then
exit_form;
End if;
- Change the keyboard help text in the KEY-EXIT trigger
property palette to Exit Orders, and set keyboard help display
to YES.
d Customize the Alert Text message in your key trigger and ensure that
it is displayed whenever the user exits the form using the
EXIT_BUTTON on the Control block.
- Replace the code in the EXIT_BUTTON When-Button -Pressed
trigger with: do_key(Exit_Form);
e Save and compile your form module. Deploy to the Web and test
your form.
If you have time
2 Disable [Enter query] in your CUSTOMERS form by creating an
appropriate key trigger. Replace [Enter Query] functionality with a call
to the customized query form CUSTQUERY. This form allows the user
to select a CUSTOMER ID, a CUSTOMER NAME, or a SALES REP
ID. The user selections are returned to your CUSTOMER form using
global variables.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-9
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-10 Oracle iDS Forms: Build Internet Applications II
Practice 4 Solutions
......................................................................................................................................................
Practice 4 Solutions
In this practice, you provide additional functionality in your forms by
defining mouse event triggers.
1 In your CUSTOMERS form, define a mouse event trigger on
S_CUSTOMER.COMMENTS that invokes the items editor when the
user double-clicks the item.
- When-Mouse-Doubleclick on s_customer.comments
Edit_TextItem;
2 In your ORDERS form change the mouse cursor symbol to busy while
the HELP canvas is displayed.
a Ensure that the default symbol is restored whenever the user hides
the HELP canvas.
- When-Button-Pressed on :control.showhelp
Set_Application_Property(cursor_style,help);
- When-Button-Pressed on :control.hidehelp
Set_Application_Property(cursor_style,normal);
b The user can close the HELP canvas without pressing the
HIDEHELP button, by navigating to an item in another block. How
can you ensure that the mouse cursor is always restored?
- Define a Post-Block trigger for the Control Data block.
Copy the code to restore the mouse cursor from your
:Control.hidehelp button When-Button-Pressed trigger.
c Save and compile your form modules. Deploy your forms to the Web
to test.You can call the ORDERS form from your CUSTOMERS
form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-11
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 5 Solutions
1 Manipulate a multiple-window form.
aIn your ORDERS form module, ensure that the form is exited when a
user closes the orders window using the window system menu box.
An alert should be displayed to users asking them to confirm that
they wish to leave the application.
- Define a When-Window-Closed trigger at Form Level.
- Call the do_key built-in to execute [Exit_Form].
b If a user closes the Inventory window through the system menu box,
ensure that the form remains open with the cursor positioned in the
Orders window.
- In the When-Window-Closed trigger, use :system.event_window
to identify the current window:
If :system.event_window = WIN_ORDER then
do_key(exit_form);
else
go_block(s_ord);
end if;
c Whenever the user navigates between the order and inventory
windows, place the cursor in the first navigable item within the
current window.
- Define a When-Window-Activated trigger at form level. Use
:system.event_window to identify the current window, and use
the GO_BLOCK built in to enforce navigation within the
appropriate window.
d Save and compile your form. Deploy your form to the Web to test.
2 In your CUSTOMERS form module, define triggers to manage tab page
navigation.
a Using an appropriate trigger, disable the COMMENTS tab page
whenever the COMMENTS item contains no text.
b The trigger should fire whenever the user navigates to another
record.
......................................................................................................................................................
A-12 Oracle iDS Forms: Build Internet Applications II
Practice 5 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-13
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-14 Oracle iDS Forms: Build Internet Applications II
Practice 6 Solutions
......................................................................................................................................................
Practice 6 Solutions
1 Create a server-side package containing a procedure to return a REF
cursor.
a Create the Orders_pkg package specification; you can import the
code from the pr6_1.txt file.
b Create the Orders_pkg package body; you can import the code from
the pr6_2.txt file.
- Use the Stored Procedure editor in Forms and import the code
from the files.
c Examine the Orders_pkg package body to identify required
parameter values.
- A value of P,C or S is passed to the REF cursor to determine
which query is required. The REF cursor can query on either
products, customers, or sales reps.
2 Open the ORDERREFCURSOR.fmb file and save as ORDREFXX where
XX is your student course number. This form contains a control block,
called CHOOSE, and a group of option buttons which allows the user to
specify a parameter value to be passed to the REF cursor.
a Create a data block called SELECTION and base it on the REF
cursor procedure that you have just created.
- Use the Data Block Wizard and select Stored Procedures for
data block type.
- Specify full procedure name:
orders_pkg.query_proc
- Press the Refresh button. Available columns will be displayed.
- Select all as Database Items.
b Pass the name of the radio group as the value for the P_VIEW
argument: :choose.view_type.
- For the P_VIEW argument, set the value to
:choose.view_type
- Select Finish to end the wizard.
c In the layout editor, customize the canvas layout to ensure that
SELECTION items are displayed to the left of the option buttons
group.
d Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-15
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 7 Solutions
1 Create a data block based on a relational table with an object column.
aCreate a form called OBJ_COLXX where XX is your student course
number.
b Using the Data Block Wizard, create a block based on the
REL_EMP_TABLE_OBJCOL relational table.
c Select the columns ID, FIRST_NAME, and LAST_NAME.
d Expand the object column DEPT_ID and select the attributes ID and
NAME. Note the names that are given to the new items.
e In the Layout Wizard, select all available items for display. Change
the prompt for item DEPT_ID to Department ID and
DEPT_ID_NAME to Department Name. Use a form layout.
f Save, compile, and test your form.
If you have time
2 Create a block based on a relational table with an REF column, and
specify an LOV to populate the REF column.
a Create a form called REF_COLXX where XX is your student course
number.
b Create a block based on the REL_EMP_TABLE_REFCOL
relational table.
c Select the columns ID, FIRST_NAME, and LAST_NAME.
d Select the DEPT_ID attributes ID and NAME.
- Note that there are two items called DEPT_ID. The first is
expandable and has the term LOOKUP in parentheses after
the name. The second represents the REF column value itself.
The REF item is included automatically when the LOV is
created.)
e Create an LOV for the REF item DEPT_ID. Select the check box,
and select OO_DEPT_TABLE as the source for the LOV.
f In the Layout Wizard, select all available items for display.
- The REF item DEPT_ID is included in the list of items in the
Object Navigator but is not included in the list of available items
in the Layout Wizard.
g In the Object Navigator, identify the canvas with which item
DEPT_ID is associated.
......................................................................................................................................................
A-16 Oracle iDS Forms: Build Internet Applications II
Practice 7 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-17
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 8 Solutions
1 Open your ORDERS form and examine the properties of the relation
called S_ORD_S_ITEM.
a Note the deletion and coordination property values.
b Run the ORDERS form and test the way deletes are handled.
2 Implement a query coordination-type toggle.
a Add two check boxes to the control block with the following
properties:
......................................................................................................................................................
A-18 Oracle iDS Forms: Build Internet Applications II
Practice 8 Solutions
......................................................................................................................................................
If GET_RELATION_PROPERTY( s_ord_s_item,
DEFERRED_COORDINATION )
= FALSE Then
SET_RELATION_PROPERTY(s_ord_s_item,
DEFERRED_COORDINATION,
PROPERTY_TRUE);
SET_ITEM_PROPERTY(control.auto_query,
ENABLED,
PROPERTY_TRUE );
Else
SET_RELATION_PROPERTY(s_ord_s_item,
DEFERRED_COORDINATION,
PROPERTY_FALSE);
SET_ITEM_PROPERTY(control.auto_query,
ENABLED,
PROPERTY_FALSE );
End If;
d Make sure that the second check box enables a user to toggle
between automatic query and no automatic query for the detail
block. This check box should be disabled if the other check box
indicates immediate coordination. You can import the code from the
pr8_2.txt file.
- When-Checkbox-Changed on CONTROL.AUTO_QUERY
If GET_RELATION_PROPERTY(s_ord_s_item,
AUTOQUERY ) = FALSE Then
SET_RELATION_PROPERTY(s_ord_s_item,
AUTOQUERY, PROPERTY_TRUE );
Else
SET_RELATION_PROPERTY(s_ord_s_item,
AUTOQUERY, PROPERTY_FALSE);
End If;
e Save, compile, and test your form.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-19
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-20 Oracle iDS Forms: Build Internet Applications II
Practice 9 Solutions
......................................................................................................................................................
Practice 9 Solutions
1 Create a multiple-form application by linking the CUSTOMERS and the
SALESREP forms. The SALESREP form provides a look up facility for
:S_CUSTOMER.SALES_REP_ID. It replaces the SALES_REP_LOV
list of values. Values are selected by mouse double click.
a Open SALESREP form and save as SALESREPXX where XX is
your student course number.
b In your CUSTOMERS form, modify the code in the
SALES_LOV_BUTTON When-Button-Pressed trigger to call the
SALESREP form.
c Ensure that the user can see, but not navigate to, your CUSTOMERS
form, while the SALESREP form is open.
d Update :S_CUSTOMER.SALES_REP_ID with the value selected
by the user in the SALESREP form. The selected Sales Rep ID is
returned in a GLOBAL variable called salesrepid. This variable
contains either a valid value or the text NOT SELECTED.
- Ensure that you call your SALESREP form which is identified
by the XX suffix.
CALL_FORM(SALESREP,no_hide);
If :global.salesrepid <> NOT SELECTED then
:S_CUSTOMER.SALES_REP_ID :=
:global.salesrepid
End if;
e Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-21
Appendix A: Practice Solutions
......................................................................................................................................................
b In the SALESREP form, ensure that whenever the form has been
opened by CALL_FORM, that a [Commit Form] performs a POST.
- In a KEY-COMMIT trigger, define the following code:
If get_application_property(calling_form)
is not null then
post;
else
commit_form;
end if;
c Ensure that updates in SALESREP are not cleared when the user
exits the form.
- SALESREP form KEY-EXIT trigger
If get_application_property(calling_form)
is not null then
exit_form(do_commit,no_rollback);
else
exit_form;
end if;
d Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
A-22 Oracle iDS Forms: Build Internet Applications II
Practice 9 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-23
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 10 Solutions
1 Create a dynamic list item populated from a design-time query record
group. The record group will hold region ID and the name of the
departments in the S_DEPT table.
a Open the Employees form. Save as EmpXX where XX is your student
course number. In the Object Navigator, create a record group named
DEPT_ID based on the query below:
SELECT name || in region ||
TO_CHAR(region_id) Name,
TO_CHAR(id) Id
FROM s_dept
UNION
SELECT none Name, 0 Id from dual
ORDER BY 1
b Convert the text item DEPT_ID into a list item, with a Poplist style.
Resize the list item in the Layout Editor.
c Create one element in the list item. Specify a label of Dummy and a
value of 0. Set the Mapping of Other Values property to 0.
d Create a procedure called POPULATE_DEPT_LIST. This procedure
will accept the list item name as an argument and populate the list
item dynamically at run time, using the design-time query record
group.
You can import the code from the pr10_1.txt file.
- Procedure Populate_Dept_List
p_list_item in varchar2) is
cst_rg_nom constant varchar2( 30 ) :=
Get_Item_Property(p_list_item,
Item_Name );
Begin
If Populate_Group( cst_rg_nom ) = 0 then
Populate_List( p_list_item, cst_rg_nom );
End If;
Copy(Get_List_Element_Value( p_list_item,1),
p_list_item);
End;
......................................................................................................................................................
A-24 Oracle iDS Forms: Build Internet Applications II
Practice 10 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-25
Appendix A: Practice Solutions
......................................................................................................................................................
Select name||to_char(region_id),
to_char(id)
from s_dept
UNION
Select none Name, to_char(0) Id
from dual
order by 1');
end if;
v_error := populate_group(v_rg_id);
populate_list('s_emp.dept_id',v_rg_id);
Copy(Get_List_Element_Value('s_emp.dept_id',
1), 's_emp.dept_id');
End;
e Call the procedure from the When-Create-Record trigger.
- When-Create-Record Trigger on the S_EMP Block:
Create_Dept_List;
f Compile and save your form module. Test.
......................................................................................................................................................
A-26 Oracle iDS Forms: Build Internet Applications II
Practice 11 Solutions
......................................................................................................................................................
Practice 11 Solutions
1 Create a picklist by using the picklist class. This picklist enables the end
user to select order items from a product list, and to place selections in a
second list.
a Create a new form module, called PICKXX where XX is your student
course number. Open the Form_Builder_II.olb object
library. This library contains form objects and code for the picklist.
Copy the PICKLIST_BASIC object group to your form module.
Copy the PICKLIST object group into your new form module.
b Ensure the CONTROL block is the last defined data block in the
Object Navigator.
c Attach the picklist.pll library. This contains the functions
and procedures required for creating the picklist.
d Define a When-New-Form-Instance trigger which will create and
populate the picklist. You can import the code from the
pr11_1.txt file.
- Declare
dummy number;
Begin
Default_Value(Y,Global.where_cls);
pick_list.create_picklist;
if :GLOBAL.where_cls = Y then
dummy := pick_list.populate_picklist_with_query(
pick_list.list_in, select name, id from
s_product order by 1);
else
dummy := pick_list.populate_picklist_with_query(
pick_list.list_in, select name, id from
s_product where || :GLOBAL.where_cls || order
by 1);
end if;
pick_list.set_picklist_selection(
pick_list.list_in,1,null);
pick_list.display_picklist(pick_list.list_in);
pick_list.display_picklist(pick_list.list_out);
End;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-27
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-28 Oracle iDS Forms: Build Internet Applications II
Practice 11 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-29
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 12 Solutions
1 Provide an alternative user interface for your Web-deployed forms by
including Pluggable Java Components (PJCs).
a Open the JAVAEMP.fmb form module. Save as JAVAXX.fmb,
where XX is your student course code.
b Change the :EMP.SAL item so that values are displayed as asterisks
at run time. Use the PJC PasswordFieldPJC.class.
This class file is held in the folder:
FORMS60_JAVADIR /oracle/forms/demos
- In the :EMP.SAL Property Palette, set the implementation class
to oracle.forms.demos.PasswordFieldPJC.
c Change the :EMP.ENAME item so that the mouse cursor changes to
hand style whenever the cursor is moved over the item. Use the
PJC ModCursor.class.
This class file is held in the folder:
FORMS60_JAVADIR /oracle/forms/demos
- In the :EMP.ENAME property palette, set the implementation
class to oracle.forms.demos.ModCursor.
......................................................................................................................................................
A-30 Oracle iDS Forms: Build Internet Applications II
Practice 12 Solutions
......................................................................................................................................................
d Create two text items, one called URL to accept a URL and one
called LABEL to accept a URL label. These will enable the user to
select a different URL. Set the maximum length for the URL text
item to 255.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-31
Appendix A: Practice Solutions
......................................................................................................................................................
- Create two text items, URL and LABEL, in the Data Block
LINK.
f Save and compile your form. Deploy your form to the Web to test.
......................................................................................................................................................
A-32 Oracle iDS Forms: Build Internet Applications II
Practice 13 Solutions
......................................................................................................................................................
Practice 13 Solutions
1 Create a stored procedure, and process error messages that may be
generated in the CUSTSERVER form.
a Open the CUSTSERVER form and save as CUSTSERVXX where
XX is your student course number. Copy the code in the
SELECT_CODE program unit and create a stored procedure called
SELECT_CUSTOMER. This procedure takes a user supplied value
from :CONTROL.NAME to check whether a customer name already
exists. Existing names will generate an error.
b Modify the When-Button-Pressed trigger for the CONTROL block
CHECK_CUSTOMER button, to trap any errors generated from the
stored procedure SELECT_CUSTOMER. If a customer already
exists, display a warning message to the user.
- Add the following code:
exception
when others then
message(sqlcode|| ||sqlerrm);
raise form_trigger_failure;
c Save and compile your form module; test.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-33
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-34 Oracle iDS Forms: Build Internet Applications II
Practice 14 Solutions
......................................................................................................................................................
Practice 14 Solutions
1 Automatically ask the users if they want to commit after a set period of
time.
a Open your CUSTOMERS form module.
b At the startup of the form, create a global variable called
GLOBAL.LOCKS_PENDING. This will indicate at all times
whether rows of the S_CUSTOMER table are locked.
The default value is NULL. Append your new code to existing code.
- When-New-Form-Instance Trigger at Form Level
...
Default_Value( NULL, GLOBAL.locks_pending);
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-35
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-36 Oracle iDS Forms: Build Internet Applications II
Practice 15 Solutions
......................................................................................................................................................
Practice 15 Solutions
1 Create a chart object by using the Chart Wizard. This chart should
display the total orders for each customer.
a Open the ORDCHART form module. Save as ORDCHARTXX
where XX is your student course number. This form module contains
a S_ORD block. Only one item from this block is visible: TITLE.
This item displays a title for your chart.
b In the Layout Editor, use the Chart tool to drag a chart area onto the
canvas. Select Use the Chart Wizard from the New Chart Object
dialog box. Do not specify a title for the chart.
c Select Column as chart type, Plain as chart subtype.
d Specify the S_ORD block as the data block that contains the data
you want to assign to chart columns.
e Select CUSTOMER_NAME to appear on the Category (X) axis, and
TOTAL to appear on the Value (Y) axis of the chart.
f Click the Finish button.
g Save and compile your form module. Deploy your form to the Web
to test. To display the chart, click in the Title item on the Chart tab.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II A-37
Appendix A: Practice Solutions
......................................................................................................................................................
d Set the Execution Mode report object property to runtime and the
Report Destination Type report object property to screen. Rename
the report object to my_report.
- Display the Property Palette for the report object.
- Select Execution Mode and change the value to RUNTIME.
- Select Report Destination Type and change the value to
SCREEN.
e Create a button named CUST_REP_BUTTON in the control block.
Display this button on the CANVAS2 canvas.
f Create a When-Button-Pressed trigger on the
CUST_REP_BUTTON button to run the report.
- DECLARE
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := FIND_REPORT_OBJECT(my_report);
v_rep := RUN_REPORT_OBJECT(repid);
END;
g Change the Query All Record property value to Yes for the
S_CUSTOMER block.
h Save and compile your form module. Deploy your form to the Web
to test. Query a customer record before calling the report.
......................................................................................................................................................
A-38 Oracle iDS Forms: Build Internet Applications II
................................
Table Descriptions
and Data
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ORD_ID
ID
S_ITEM S_ORD
PRODUCT_ID CUSTOMER_ID
SALES_REP_ID
S_INVENTORY
*
PRODUCT_ID
ID
ID ID
S_CUSTOMER
S_PRODUCT SALES_REP_ID
IMAGE_ID
ID ID ID
S_IMAGE S_EMP
DEPT_ID
ID
S_DEPT
......................................................................................................................................................
B-2 Oracle iDS Forms: Build Internet Applications II
S_CUSTOMER Description
.....................................................................................................................................................
S_CUSTOMER Description
Column Name Null? Datatype
-------------- --------- ------------- -----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)
PHONE VARCHAR2(25)
ADDRESS VARCHAR2(400)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRY VARCHAR2(30)
ZIP_CODE VARCHAR2(75)
CREDIT_RATING VARCHAR2(9)
SALES_REP_ID NUMBER(7)
REGION_ID NUMBER(7)
COMMENTS VARCHAR2(255)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-3
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_CUSTOMER Data
......................................................................................................................................................
B-4 Oracle iDS Forms: Build Internet Applications II
S_CUSTOMER Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-5
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-6 Oracle iDS Forms: Build Internet Applications II
S_CUSTOMER Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-7
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID NAME REGION_ID
------ ---------------- -----------------
10 Finance 1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1
12 rows selected.
......................................................................................................................................................
B-8 Oracle iDS Forms: Build Internet Applications II
S_EMP Description
.....................................................................................................................................................
S_EMP Description
Column Name Null? Datatype
------------------------ -------------- --------------
ID NOT NULL NUMBER(7)
LAST_NAME NOT NULL VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
COMMENT VARCHAR2(255)
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID NUMBER(7)
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-9
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_EMP Data
......................................................................................................................................................
B-10 Oracle iDS Forms: Build Internet Applications II
S_EMP Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-11
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-12 Oracle iDS Forms: Build Internet Applications II
S_ITEM Description
.....................................................................................................................................................
S_ITEM Description
Column Name Null? Datatype
------------------------- -------------- ----------
ORD_ID NOT NULL NUMBER(7)
ITEM_ID NOT NULL NUMBER(7)
PRODUCT_ID NOT NULL NUMBER(7)
PRICE NUMBER(11,2)
QUANTITY NUMBER(9)
QUANTITY_SHIPPED NUMBER(9)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-13
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_ITEM Data
......................................................................................................................................................
B-14 Oracle iDS Forms: Build Internet Applications II
S_ITEM Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-15
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
16 rows selected.
......................................................................................................................................................
B-16 Oracle iDS Forms: Build Internet Applications II
S_PRODUCT Description
.....................................................................................................................................................
S_PRODUCT Description
Column Name Null? Datatype
---------------------------------- -----------------
ID NOT NULL NUMBER(7)
NAMENOT NULL VARCHAR2(50)
SHORT_DESC VARCHAR2(255)
LONGTEXT_ID NUMBER(7)
IMAGE_ID NUMBER(7)
SUGGESTED_WHLSL_PRICE NUMBER(11,2)
WHLSL_UNITS VARCHAR2(25)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-17
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_PRODUCT Data
......................................................................................................................................................
B-18 Oracle iDS Forms: Build Internet Applications II
S_PRODUCT Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-19
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-20 Oracle iDS Forms: Build Internet Applications II
S_PRODUCT Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-21
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID NAME
--- --------------------------
1 North America
2 South America
3 Africa / Middle East
4 Asia
5 Europe
......................................................................................................................................................
B-22 Oracle iDS Forms: Build Internet Applications II
S_TITLE Description and Data
.....................................................................................................................................................
TITLE
------------------------
President
Sales Representative
Stock Clerk
VP, Administration
VP, Finance
VP, Operations
VP, Sales
Warehouse Manager
8 rows selected.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-23
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
emp_type_RefCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
dept_type
--------------------------------- ----------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)
......................................................................................................................................................
B-24 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
Tables
oo_emp_Table_ObjCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
ID LAST_NAME FIRST_NAME USERID
--------- --------------------- --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1Velasquez Carmencvelasqu
03-MAR-90 President
DEPT_TYPE(50, Administration, 1)
2500
2Ngao LaDorislngao
08-MAR-90 1 VP Operations
DEPT_TYPE(41, Operations, 1)
1450
3Nagayama Midorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, Sales, 1)
1400
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-25
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-26 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-27
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-28 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
oo_emp_Table_RefCol
Name Null? Type
------------------------------ ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-29
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-31
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-32 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-33
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
oo_dept_table
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)
ID NAME REGION_ID
-------------------- ------------- ----------------
10 Finance 1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
......................................................................................................................................................
B-34 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
44 Operations 4
45 Operations 5
50 Administration 1
rel_emp_Table_Objcol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
......................................................................................................................................................
B-36 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-37
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-38 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
rel_emp_Table_RefCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-39
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-40 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-41
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-42 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-43
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-44 Oracle iDS Forms: Build Internet Applications II
Oracle8i Objects: Types, Tables
.....................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II B-45
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
......................................................................................................................................................
B-46 Oracle iDS Forms: Build Internet Applications II
................................
Introduction
Overview
You have already seen how to use mouse action triggers and built-ins. This appendix
explains how to develop drag-and-drop functionality with Client Server forms
applications.
Objectives
After completing this appendix, you should be able to implement drag-and-drop
functionality with Client Server forms.
Item-A highlighted
Items repositioned
......................................................................................................................................................
C-2 Oracle iDS Forms: Build Internet Applications II
Introduction
.....................................................................................................................................................
Notes Page
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II C-3
Appendix C: Mouse Movement Events
.....................................................................................................................................................
......................................................................................................................................................
C-4 Oracle iDS Forms: Build Internet Applications II
Drag and Drop
.....................................................................................................................................................
Summary
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II C-5
Appendix C: Mouse Movement Events
.....................................................................................................................................................
Summary
In this Appendix, you should have learned how to implement drag-and-drop
functionality in your Client Server form applications by using appropriate mouse
triggers and system variables.
Mouse Triggers
When_Mouse_Move
When_Mouse_Up
When_Mouse_Down
......................................................................................................................................................
C-6 Oracle iDS Forms: Build Internet Applications II
................................
Introduction to
Oracle8i Object Features
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Objectives
......................................................................................................................................................
D-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
In this appendix you will review certain object features of Oracle8i. This appendix
also explains how these objects are displayed in the Object Navigator.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-3
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
NCHAR
NVARCHAR2
FLOAT
NLS types
......................................................................................................................................................
D-4 Oracle iDS Forms: Build Internet Applications II
New Oracle8i Data Types
......................................................................................................................................................
NLS Types
Oracle8i offers extended National Language Support (NLS) including national
character sets and the data types NCHAR and NVARCHAR2, which store NLS data.
With NLS, number and date formats adapt automatically to the language conventions
specified for a user session. Thus, users around the world can interact with the Oracle
Database Server in their native languages. NLS is discussed in Oracle8i Server
Reference Manual.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-5
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Object Types
Attributes
ORDER
po_no
custinfo
line_items
amount
Methods
......................................................................................................................................................
D-6 Oracle iDS Forms: Build Internet Applications II
Object Types
......................................................................................................................................................
Object Types
An object type is a user-defined composite data type. You build object types from
predefined data types or from previously defined object types. When you create an
object type you specify the component types from which it is built. You also specify
the functions and procedures that can act on the object type. Thus, an object type is in
some ways similar to a record type, and in some ways similar to a package.
An object type must have one or more attributes and can contain methods.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-7
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Object Types
Ship
ORDER
Check Cancel
status
Hold
......................................................................................................................................................
D-8 Oracle iDS Forms: Build Internet Applications II
Object Types
......................................................................................................................................................
Methods An object type is also similar to a package. Once an object is declared, its
attributes are similar to package variables. Like packages, object types can contain
procedures and functions. In object types, these subprograms are known as methods.
A method describes the behavior of an object type.
Like packages, object types can be declared in two parts: a specification and a body.
Like package variables, attributes declared in the object type specification are public
and those declared in the body are private. As with package subprograms, all methods
are defined in the package body, but only those whose specification appears in the
object type specification are public methods.
Here is an example of an object type:
CREATE TYPE dept_type AS OBJECT
(dept_idNUMBER(2),
dnameVARCHAR2(14),
loc VARCHAR2(3),
MEMBER PROCEDURE set_dept_id (d_id NUMBER),
PRAGMA RESTRICT_REFERENCES (set_dept_id,
RNDS,WNDS,RNPS,WNPS),
MEMBER FUNCTION get_dept_id RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES (get_dept_id,
RNDS,WNDS,RNPS,WNPS));
CREATE TYPE BODY dept_type AS
MEMBER PROCEDURE set_dept_id (d_id NUMBER)
IS
BEGIN
dept_id := d_id;
END;
MEMBER FUNCTION get_dept_id
RETURN NUMBER
IS
BEGIN
RETURN (dept_id);
END;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-9
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Object Tables
......................................................................................................................................................
D-10 Oracle iDS Forms: Build Internet Applications II
Creating Oracle8i Objects
......................................................................................................................................................
Object Tables
One way to create an object is to create a table whose rows are objects of that object
type.
Here is an example of an object table declaration:
CREATE TABLE o_dept OF dept_type;
SQL and PL/SQL treat object tables very similarly to relational tables, with the
attribute of the object corresponding to the columns of the table, but there are
significant differences. The most important difference is that rows in an object table
are assigned object IDs (OIDs) and can be referenced by using a REF type.
Note: REF types are reviewed later.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-11
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Object Columns
......................................................................................................................................................
D-12 Oracle iDS Forms: Build Internet Applications II
Object Columns
......................................................................................................................................................
Object Columns
Another construct that you can base on an object type is an object column in a
relational table. Here is an example of a relational table creation statement with an
object column:
CREATE TABLE o_customer (
custid NUMBER (6) NOT NULL,
name VARCHAR2 (45),
repid NUMBER (4) NOT NULL,
creditlimit NUMBER (9,2),
address address_type,
phone phone_type);
In the object table, the rows of a table are objects. In a relational table with an object
column, the column is an object. The table will usually have standard columns, as well
as one or more object column.
Object columns are not assigned object IDs (OIDs), and therefore cannot be
referenced by using object REF values.
Note: Object REFs are reviewed later in this section.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-13
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Object Views
......................................................................................................................................................
D-14 Oracle iDS Forms: Build Internet Applications II
Object Views
......................................................................................................................................................
Object Views
Often the most difficult part of adopting a new technology is the conversion process
itself. For example, a large enterprise might have several applications accessing the
same data stored in relational tables. If such an enterprise decided to start using object-
relational technology, it would not convert all of the applications at once, but would
convert the applications one at a time.
This presents a problem. The applications that have been converted need the data
stored as objects, while the applications that have not been converted need the data
stored in relational tables.
This dilemma is addressed by object views. Like all views, an object view transforms
the way a table appears to a user, without changing the actual structure of the table.
Object views make relational tables look like object tables. This enables developers to
postpone converting the data from relational structures to object-relational structures
until after all of the applications have been converted. During the conversion process,
the object-relational applications can operate against the object view, while the
relational applications can continue to operate against the relational tables.
Objects accessed through object views are assigned Object IDs (OIDs) and can be
referenced by using Object REFs.
Note: Object REFs are reviewed later in this section.
Here is an example of an object view creation statement:
CREATE VIEW emp_view OF emp_type
WITH OBJECT OID (eno)
AS
SELECT e.empno, e.ename, e.sal, e.job
FROM emp e;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-15
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
INSTEAD-OF Triggers
DECLARE
BEGIN
EXCEPTION
END;
......................................................................................................................................................
D-16 Oracle iDS Forms: Build Internet Applications II
INSTEAD-OF Triggers
......................................................................................................................................................
INSTEAD-OF Triggers
INSTEAD-OF triggers provide a transparent way of modifying views that cannot be
modified directly through SQL DML statements (INSERT, UPDATE, and DELETE).
These triggers are called INSTEAD-OF triggers because, unlike other types of
triggers, Oracle fires the trigger instead of executing the triggering statement. The
trigger performs update, insert, or delete operations directly on the underlying tables.
Users write normal INSERT, DELETE, and UPDATE statements against the view, and
the INSTEAD-OF trigger works invisibly in the background to make the right actions
take place.
INSTEAD-OF triggers are activated for each row.
Note: Although you can use INSTEAD-OF triggers with any view, they are typically
required with object views.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-17
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
References to Objects
OID
......................................................................................................................................................
D-18 Oracle iDS Forms: Build Internet Applications II
Referencing Objects
......................................................................................................................................................
Referencing Objects
Introduction
In relational databases, primary-key values are used to uniquely identify records. In
object-relational databases, OIDs provide an alternate method.
When a row in an object table or object view is created, it is assigned automatically a
unique identifier called an object ID (OID).
Object REFs
With relational tables, you can associate two records by storing the primary key of one
record in one of the columns (the foreign-key column) of another.
In a similar way, you can associate a row in a relational table to an object by storing
the OID of an object in a column of a relational table.
Or you can associate two objects by storing the OID of one object in an attribute of
another.
The stored copy of the OID then becomes a pointer, or reference (REF), to the original
object.
The attribute or column that holds the OID is of data type REF.
Note: Object columns are not assigned OIDs and cannot be pointed to by a REF.
Here is an example of a table declaration that includes a column with a REF data type:
CREATE TABLE o_emp
( empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(10),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
dept REF dept_type SCOPE IS o_dept) ;
Note: The REF is scoped here to restrict the reference to a single table, o_dept. The
object itself is not stored in the table; only the OID value for the object is stored there.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-19
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
......................................................................................................................................................
D-20 Oracle iDS Forms: Build Internet Applications II
Displaying Oracle8i Objects in the Object Navigator
......................................................................................................................................................
Object Types
Both the attributes and the methods are listed under each type. Additionally, the nested
types within address_and_phone_type are displayed in an indented sublevel.
This convention is used for nested object and object type displays throughout Oracle
Forms Developer.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-21
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
......................................................................................................................................................
D-22 Oracle iDS Forms: Build Internet Applications II
Displaying Oracle8i Objects in the Object Navigator
......................................................................................................................................................
Object Tables
Object tables are displayed like relational tables, with the attributes of the object
displayed like columns in a relational table. Additionally, the object table type name is
displayed in parentheses after the name of the object table.
Object Columns
Object columns are displayed with the object type in parentheses after the column
name, and with the attributes of the type indented underneath the column name.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-23
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
......................................................................................................................................................
D-24 Oracle iDS Forms: Build Internet Applications II
Displaying Oracle8i Objects in the Object Navigator
......................................................................................................................................................
Object Views
Object views are displayed like any other view, except that the object type they are
based on is written in parentheses after the view name.
INSTEAD-OF Triggers
You can create INSTEAD-OF database triggers through the trigger creation dialog
box, just as you would any other database trigger.
INSTEAD-OF INSERT, UPDATE, and DELETE triggers allow you to directly insert,
update, and delete against object views. They can also be used with any other type of
view that does not allow direct DML.
When a view has an INSTEAD-OF trigger, the code in the trigger is executed in place
of the triggering DML code.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-25
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
......................................................................................................................................................
D-26 Oracle iDS Forms: Build Internet Applications II
Displaying Oracle8i Objects in the Object Navigator
......................................................................................................................................................
Object REFs
Object types that contain attributes of type REF, and relational tables that have
columns of type REF, display the keyword REF before the name of the object type that
is being referenced.
The attributes of the referenced object type are displayed indented underneath the
column or attribute.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-27
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
D-28 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
New Oracle8i Data Types
Oracle8i introduced three new scalar data types and new composite data types such as
object types.
Objects
Three kinds of objects are object tables, object columns, and object views.
INSTEAD-OF triggers allow DML on object views.
Object REFs store the Object Identifier of certain types of objects.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II D-29
Appendix D: Introduction to Oracle8i Object Features
......................................................................................................................................................
......................................................................................................................................................
D-30 Oracle iDS Forms: Build Internet Applications II
................................
Menu Run-Time
Parameters
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Objectives
......................................................................................................................................................
E-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn how to modify menus dynamically, as well as
how to control application security through menu access.
Objectives
After completing this lesson, you should be able to customize menu modules
by using substitution parameters.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-3
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
UN Current username
PW Current password
AD Directory name
TT Terminal type
LN Language used
......................................................................................................................................................
E-4 Oracle iDS Forms: Build Internet Applications II
Substitution Parameters
......................................................................................................................................................
Substitution Parameters
What Is a Substitution Parameter?
A substitution parameter is a two-character variable of type CHAR that is
referenced in a menu item command or in a PL/SQL program unit, and
substituted with a value at run time. A menu module provides some
predefined parameters, which automatically exist in every menu module.
You can also create in Form Builder (valid for a given menu module) your
own user-named parameters.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-5
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Parameter Properties
- Name
- Label
- Maximum Length
- Case Restriction
- Menu Parameter
- Conceal Data Initial Value
- Associated Menus - Required
- Hint
......................................................................................................................................................
E-6 Oracle iDS Forms: Build Internet Applications II
Defining a User-Named Substitution Parameter
......................................................................................................................................................
Property Description
Name The two-letter parameter name
Label The text prompt for the parameter value that is displayed in
the Enter Parameter Values dialog box
Case Restriction The property that converts the case of the users input to
either uppercase, lowercase, or none
Conceal Data The property that determines whether the users input is ech-
oed on the screen
Associated Menus All menu names where the parameter can be used (full-screen
menus only)
Maximum Length Value maximum length
Menu Parameter Initial Value The default value for the parameter; displayed in the parame-
ter value field when the Enter Parameter Values dialog box is
displayed
Required Mandatory or not; set Yes if the value is required or No to
allow the parameter value to be set to Null
Hint The text string displayed on the message line of the console
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-7
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
QUERY_PARAMETER
APPLICATION_PARAMETER
......................................................................................................................................................
E-8 Oracle iDS Forms: Build Internet Applications II
Substitution Parameter Built-ins
......................................................................................................................................................
Example
This example invokes SQL*Plus and runs a command file (CF parameter).
PLUS80W &UN/&PW @&CF
Example
This example invokes Report Builder and enables the user to provide the
report name.
Query_Parameter(&RN);
Run_Product(reports, :RN, synchronous, runtime, filesystem, pl_id,
null);
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-9
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Validating Substitution
Parameter Values
MENU_SUCCESS function:
Returns TRUE if the user does not cancel
the Enter Parameter Values dialog box
Is used in a WHILE loop
......................................................................................................................................................
E-10 Oracle iDS Forms: Build Internet Applications II
Validating a Substitution Parameter Value
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-11
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Summary
......................................................................................................................................................
E-12 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Substitution Parameters
Using &UN, &PW, &AD, &SO, &TT, and &LN
Creating user-named substitution parameters
Programmatically controlling substitution parameters with
QUERY_PARAMETER and APPLICATION_PARAMETER
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II E-13
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
......................................................................................................................................................
E-14 Oracle iDS Forms: Build Internet Applications II
................................
Handling Server-
SideErrors
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
Objectives
......................................................................................................................................................
F-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson covers the use of Oracle server features in Form Builder
applications. You will learn about handling Oracle server errors, including
declarative-constraint violations.
Objectives
At the end of this lesson, you should be able to:
Handle errors raised by the Oracle server
Obtain the cause of declarative-constraint violations
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-3
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
......................................................................................................................................................
F-4 Oracle iDS Forms: Build Internet Applications II
Obtaining the Cause of Declarative-Constraint Violations
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-5
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
Technical Note
A foreign-key constraint violation can have two causes: parent key not
found or child record found. Therefore, two error messages are
associated with one foreign-key constraint name.
......................................................................................................................................................
F-6 Oracle iDS Forms: Build Internet Applications II
Customizing Oracle Server Error Messages
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-7
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
......................................................................................................................................................
F-8 Oracle iDS Forms: Build Internet Applications II
Example Procedure for Handling Oracle Server Errors
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-9
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
Technical Note
Error code 40508 is insert failed. Error code 40509 is update failed. Error
code 40510 is delete failed.
......................................................................................................................................................
F-10 Oracle iDS Forms: Build Internet Applications II
Example Procedure for Handling Oracle Server Errors
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-11
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
Summary
......................................................................................................................................................
F-12 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
Handling Errors Raised by the Oracle Server
Causes: Declarative constraints, database triggers, stored program units
Trap implicit-DML errors by using DBMS_ERROR_CODE and
DBMS_ERROR_TEXT in an On-Error trigger
Trap explicit DML errors and stored program unit errors by using
SQLCODE and SQLERRM in a WHEN OTHERS exception handler
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II F-13
Appendix F: Handling Server-SideErrors
......................................................................................................................................................
......................................................................................................................................................
F-14 Oracle iDS Forms: Build Internet Applications II
................................
EMP_PKG Package
Appendix G: EMP_PKG Package
......................................................................................................................................................
Package Specification
/*******************************************************/
/* This is an example of a stored procedure that: */
/* query, insert, update, delete, and lock rows of the */
/* EMP table. */
/* A package is used to logically group the related */
/* data types and procedures */
/*******************************************************/
PACKAGE emp_pkg AS
......................................................................................................................................................
G-2 Oracle iDS Forms: Build Internet Applications II
Package Specification
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II G-3
Appendix G: EMP_PKG Package
......................................................................................................................................................
Package Body
PACKAGE BODY emp_pkg AS
/**************************/
/* QUERY USING REF CURSOR */
/**************************/
PROCEDURE empquery_refcur( block_data IN OUT empcur,
p_deptno IN NUMBER)
IS
BEGIN
OPEN block_data FOR
SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno
FROM emp
WHERE deptno = NVL(p_deptno, deptno)
ORDER BY empno;
END;
. . .
......................................................................................................................................................
G-4 Oracle iDS Forms: Build Internet Applications II
Package Body
......................................................................................................................................................
/********************************/
/* QUERY USING TABLE OF RECORDS */
/********************************/
PROCEDURE empquery( block_data IN OUT emptab,
p_deptno IN NUMBER)
IS
i NUMBER;
CURSOR empselect IS
SELECT empno, ename, job, mgr, hiredate,
sal, comm, deptno
FROM emp
WHERE deptno = NVL(p_deptno, deptno)
ORDER BY empno;
BEGIN
OPEN empselect;
i := 1;
LOOP
FETCH empselect INTO block_data(i).empno,
block_data(i).ename,
block_data(i).job,
block_data(i).mgr,
block_data(i).hiredate,
block_data(i).sal,
block_data(i).comm,
block_data(i).deptno;
EXIT WHEN empselect%NOTFOUND;
i := i + 1;
END LOOP;
END;
. . .
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II G-5
Appendix G: EMP_PKG Package
......................................................................................................................................................
/**********/
/* INSERT */
/**********/
PROCEDURE empinsert(block_data IN emptab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
INSERT INTO emp( empno, ename, job, mgr,
hiredate, sal, comm, deptno)
VALUES( block_data(i).empno, block_data(i).ename,
block_data(i).job, block_data(i).mgr,
block_data(i).hiredate, block_data(i).sal,
block_data(i).comm, block_data(i).deptno);
END LOOP;
END;
. . .
......................................................................................................................................................
G-6 Oracle iDS Forms: Build Internet Applications II
Package Body
......................................................................................................................................................
/**********/
/* UPDATE */
/**********/
PROCEDURE empupdate(block_data IN emptab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
UPDATE emp
SET ename = block_data(i).ename,
job = block_data(i).job,
mgr = block_data(i).mgr,
hiredate = block_data(i).hiredate,
sal = block_data(i).sal,
comm = block_data(i).comm,
deptno = block_data(i).deptno
WHERE empno = block_data(i).empno;
END LOOP;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II G-7
Appendix G: EMP_PKG Package
......................................................................................................................................................
/**********/
/* DELETE */
/**********/
PROCEDURE empdelete(block_data IN empnotab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
DELETE FROM emp WHERE empno = block_data(i).empno;
END LOOP;
END;
/********/
/* LOCK */
/********/
PROCEDURE emplock(block_data IN empnotab)
IS
i NUMBER;
cnt NUMBER;
block_rec emprec;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
SELECT empno, ename, job, mgr,
hiredate, sal, comm, deptno
INTO block_rec
FROM emp
WHERE empno = block_data(i).empno
FOR UPDATE OF ename NOWAIT;
END LOOP;
END;
END;
......................................................................................................................................................
G-8 Oracle iDS Forms: Build Internet Applications II
Package Body
......................................................................................................................................................
To have an idea of how Form Builder works when a data block is based on a
stored procedure returning a REF CURSOR, you can run the following
script under Sql*Plus:
DECLARE
v_rec emp_pkg.emprec;
v_ref emp_pkg.empcur;
BEGIN
emp_pkg.emp_query_refcur(v_ref, 10);
LOOP
FETCH v_ref INTO v_rec;
EXIT WHEN v_ref%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_rec.empno);
DBMS_OUTPUT.PUT_LINE(v_rec.ename);
DBMS_OUTPUT.PUT_LINE(v_rec.job);
DBMS_OUTPUT.PUT_LINE(v_rec.mgr);
DBMS_OUTPUT.PUT_LINE(v_rec.hiredate);
DBMS_OUTPUT.PUT_LINE(v_rec.sal);
DBMS_OUTPUT.PUT_LINE(v_rec.comm);
DBMS_OUTPUT.PUT_LINE(v_rec.deptno);
END LOOP;
CLOSE v_ref;
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II G-9
Appendix G: EMP_PKG Package
......................................................................................................................................................
......................................................................................................................................................
G-10 Oracle iDS Forms: Build Internet Applications II
................................
Objectives
......................................................................................................................................................
H-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
In this appendix, you will learn how to include and use ActiveX controls in
your Oracle Forms Developer application.
Objectives
After completing this lesson, you should be able to do the following:
Explain the differences between VBX, OCX, and ActiveX controls
Access ActiveX properties at design time and run time
Import ActiveX control methods and events packages
Customize event handling
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-3
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-4 Oracle iDS Forms: Build Internet Applications II
What Are VBX, OCX, and ActiveX Controls?
......................................................................................................................................................
What Is a VBX?
Short for Visual Basic custom control, a VBX is a reusable software
component designed for use in many different applications. While VBXs
can be used in other environments, they were initially created for developing
Windows applications with Visual Basic. An application developer can use a
number of selected VBXs to quickly develop an application.
What Is an OCX?
Short for OLE Custom control, an OCX is an independent program module
that can be accessed by other programs in a Windows environment. OCX
controls end with the .ocx extension. OCX controls represent Microsofts
second generation of control architecture, the first being VBX controls
written in Visual Basic.
What Is an ActiveX?
ActiveX controls are a superset of OLE Custom control (OCX). ActiveX is
an open platform that combines desktop and Web technologies. An ActiveX
control can be automatically downloaded and executed by a Web browser.
ActiveX is not a programming language, but rather a set of rules for how
applications should share information. Programmers can develop ActiveX
controls in a variety of languages, including C, C++, Visual Basic, and Java.
They represent Microsofts third generation of control architecture, the first
being VBX controls and the second OCX controls.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-5
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Web- No No Yes
enabled
......................................................................................................................................................
H-6 Oracle iDS Forms: Build Internet Applications II
Comparison of VBX, OCX, and ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-7
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
ActiveX controls:
Dynamic library in .ocx files
Support events, properties, and methods
ActiveX control item:
Container for the ActiveX control
Single-record property set to Yes
......................................................................................................................................................
H-8 Oracle iDS Forms: Build Internet Applications II
ActiveX in Form Builder
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-9
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Creating an ActiveX
Control Item
......................................................................................................................................................
H-10 Oracle iDS Forms: Build Internet Applications II
Implementing an ActiveX Control
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-11
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
OLE
OLE Class
Class
Control
Control Properties
Properties
About
About Control
Control
Control
Control Help
Help
Technical Note
If you have created a container using the OCX button from the Layout
Editor, then Create Control is the only available option on the Insert Object
dialog box.
......................................................................................................................................................
H-12 Oracle iDS Forms: Build Internet Applications II
Inserting an ActiveX Control in an ActiveX Control Item
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-13
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
2 6
- Program Units
+ PackageName1 (Spec)
3 + PackageName1 (Body)
+ ...
4 5
......................................................................................................................................................
H-14 Oracle iDS Forms: Build Internet Applications II
Importing ActiveX Control Methods and Events Packages
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-15
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Three methods:
Bind variable Syntax
:Item(item_name).OCX.server_name.property
:Item( item_name).OCX.server_name.property
Example
:item(ActXitem).OCX.Spindial.spindialctrl
:item( ActXitem).OCX.Spindial.spindialctrl
.1.Needleposition:=:item(ActXitem).OCX.
.1.Needleposition:=:item(ActXitem).OCX.
Spindial.spindialctrl.1.Needleposition
Spindial.spindialctrl.1.Needleposition
++ 1;
1;
......................................................................................................................................................
H-16 Oracle iDS Forms: Build Internet Applications II
Setting and Getting ActiveX Control Properties
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-17
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
tblname varchar2;
tblname := table_pkg.TableName(
:item(Oblk.Oitm).interface);
......................................................................................................................................................
H-18 Oracle iDS Forms: Build Internet Applications II
Setting and Getting ActiveX Control Properties
......................................................................................................................................................
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-19
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
MMVX_DMMVX.PLAY(:item
MMVX_DMMVX.PLAY(:item
((video_ocx.video
video_ocx.video).INTERFACE);
).INTERFACE);
......................................................................................................................................................
H-20 Oracle iDS Forms: Build Internet Applications II
Invoking ActiveX Control Methods
......................................................................................................................................................
Example
/* Getting a cell value from a Spread Table ActiveX control
using the GetCellByColRow method provided in the
SpreadTable package */
DECLARE
Cur_Row number;
Cur_Col number;
OLEObj OleObj;
BEGIN
Cur_Row:=SpreadTable.CurrentRow(:ITEM(BLK.ITM).interface);
Cur_Col:=SpreadTable.CurrentCol(:ITEM(BLK.ITM).interface);
OLEObj:=SpreadTable.GetCellByColRow(:ITEM(BLK.ITM).interface,
Cur_Col, Cur_Row);
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-21
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
FORMS4W.DISPATCH_EVENT
(RESTRICTED_UNALLOWED);
......................................................................................................................................................
H-22 Oracle iDS Forms: Build Internet Applications II
Responding to ActiveX Control Events
......................................................................................................................................................
Initialization Events
Initialization events for ActiveX controls do not fire in Forms run time.
These initialization events are intentionally disabled. Instead, you can use
When-New-Item-Instance or When-New-Record-Instance triggers in place
of the controls native initialization events.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-23
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Handling Exceptions
. . .
WHEN FORMS_OLE_FAILURE THEN
ExceptNum :=LAST_OLE_EXCEPTION(errScr,
errDescription, errHelpfile,
errHelpContext);
. . .
Technical Note
The LAST_OLE_EXCEPTION built-in takes variables, not constants.
......................................................................................................................................................
H-24 Oracle iDS Forms: Build Internet Applications II
Handling Exceptions
......................................................................................................................................................
Handling Exceptions
FORMS_OLE_FAILURE Exception
When a failure is detected in handling an ActiveX control method, an FRM
message appears or the FORMS_OLE_FAILURE exception is raised. When
a FORMS_OLE_FAILURE exception is raised, you can get more detailed
information regarding the cause of the exception by calling the
LAST_OLE_EXCEPTION built-in.
/*
Handling the exception raised as a result of calling:
Var_To_Number(To_Variant(Jane));
An exception is raised because Jane is not a number.
*/
DECLARE
errCode PLS_INTEGER;
errSrc VARCHAR2(200);
errDescription VARCHAR2(2000);
errHelpfile VARCHAR2(200);
errHelpContext PLS_INTEGER;
BEGIN
. . .
WHEN form_ole_failure THEN
errCode := LAST_OLE_EXCEPTION(errSrc,
errDescription,
errHelpfile,
errHelpContext);
-- Inform the user of the problem
MESSAGE(errSrc||;||errDescription);
END;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-25
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-26 Oracle iDS Forms: Build Internet Applications II
Registering an ActiveX Control
......................................................................................................................................................
Supporting Files
Most ActiveX controls require a supporting DLL, such as the Microsoft
Foundation Class run-time library, mfc40.dll. The DLL must be in the
\WINDOWS\SYSTEM directory or in the search path. If the DLL is out of
date or missing, your ActiveX control will not register properly. Most
reputable ActiveX control suppliers provide documentation regarding the
version and name of the DLLs required; some even supply and install them
along with the ActiveX controls.
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-27
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
.
Summary
......................................................................................................................................................
H-28 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
In this lesson, you saw how to include and use ActiveX controls in your
Oracle Developer application.
VBX, OCX, and ActiveX controls
Differences between controls
ActiveX control in Form Builder
Create an ActiveX control
Set and get ActiveX control properties
Invoke ActiveX control methods
Respond to ActiveX control events
Register an ActiveX control
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II H-29
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-30 Oracle iDS Forms: Build Internet Applications II
................................
SESSION_ROLES
ROLE_ROLE_PRIVS
ROLE_SYS_PRIVS
ROLE_TAB_PRIVS
......................................................................................................................................................
I-2 Oracle iDS Forms: Build Internet Applications II
Using Oracle Server Roles at Run Time
......................................................................................................................................................
SESSION_ROLES View
Roles that the user currently has enabled
Column Description
ROLE Name of the role
ROLE_ROLE_PRIVS View
Information about roles granted to other roles
Column Description
ROLE Name of the role
GRANTED_ROLE Role that was granted
ADMIN_OPTION Subprogram that signifies that the role was granted with the ADMIN
option
ROLE_SYS_PRIVS View
Information about system privileges granted to roles
Column Description
ROLE Name of the role
PRIVILEGES System privileges granted to the role
ADMIN_OPTION Column that signifies the grant was with the ADMIN option
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II I-3
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
SESSION_ROLES
ROLE_ROLE_PRIVS
ROLE_SYS_PRIVS
ROLE_TAB_PRIVS
......................................................................................................................................................
I-4 Oracle iDS Forms: Build Internet Applications II
Using Oracle Server Roles at Run Time
......................................................................................................................................................
ROLE_TAB_PRIVS View
Information about table privileges granted to roles.
Column Description
ROLE Name of the role
OWNER Owner of the object
TABLE_NAME Name of the object
COLUMN_NAME Name of the column, if applicable
PRIVILEGE Object privilege granted to the role
GRANTABLE YES if the role was granted with the ADMIN option, otherwise NO
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II I-5
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
DBMS_SESSION.SET_ROLE
DBMS_SESSION.IS_ROLE_ENABLED
......................................................................................................................................................
I-6 Oracle iDS Forms: Build Internet Applications II
Procedures for Managing Roles
......................................................................................................................................................
Example
The following Pre-Form trigger uses the DBMS_SESSION package to test a
users role before allowing access to the application.
IF not (DBMS_SESSION.IS_ROLE_ENABLED(ADMINISTRATIVE) or
(DBMS_SESSION.IS_ROLE_ENABLED(TECHNICAL)
THEN
MESSAGE(You are not authorized to run this application);
PAUSE;
RAISE form_trigger_failure;
END IF;
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II I-7
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
......................................................................................................................................................
I-8 Oracle iDS Forms: Build Internet Applications II