Professional Documents
Culture Documents
iDS Forms - II - Vol - I
iDS Forms - II - Vol - I
.......................................................................................
nly
e O
Us
AI
& O
al
ern
Int
40034GC11
cle
Production 1.1
ra
June 2001
OD33129
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
nly
O
Jayne Marlow
e
Sergei Pechersky
Milos Randak
Us
I
Jonas Reborg
Bryan Roberts
Candace Stover
OA
Hiroyuki Sugiyama
l &
Laura Tejero
Jack Walsh
rna
nte
e I
cl
Publisher
ra
Shane Mattimoe
O
Contents
.....................................................................................................................................................
Contents
Preface
Profile xv
Related Publications xvi
Typographic Conventions xvii
Introduction
Introduction I-2
Course Content I-3
ly
Implementing Menu Toolbars 1-23
Storing the Menu Module 1-25
On
Attaching the Menu Module 1-27
se
U
Pop-up Menus 1-29
Summary 1-31
AI
Practice Overview: Lesson 1 1-33
& O
l
Practice 1 1-34
rna
Lesson 2: Managing Menu Modules
te
Introduction 2-3
n
e I
Using PL/SQL in Menu Item Code 2-5
ra
O
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II iii
Contents
.....................................................................................................................................................
e O
s
Responding to Mouse Button Actions 4-11
Summary 4-15
I U
Practice Overview: Lesson 4 4-17
Practice 4 4-18
OA
l &
rna
Lesson 5: Controlling Windows and Canvases Programmatically
e
Introduction 5-3
Int
Using Window-Interaction Triggers 5-5
le
Built-ins for Manipulating Windows 5-7
c
a
Built-ins for Manipulating Canvases 5-9
Or
.....................................................................................................................................................
iv Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
ly
of Records 6-17
Data Block Wizard 6-19
Data Block Properties 6-21
On
Data Source Guidelines 6-23
se
Summary 6-27
I U
Practice Overview: Lesson 6 6-29
OA
&
Practice 6 6-30
al
ern
Lesson 7: Working with Oracle8i Objects in Form Builder
t
Introduction 7-3
In
What Are Object Types? 7-5
cle
Review of Objects 7-7
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II v
Contents
.....................................................................................................................................................
ly
Implementing a Coordination-Type Toggle 8-17
Forcing a Commit Per Master 8-19
On
e
Summary 8-21
Practice Overview: Lesson 8 8-23
Us
Practice 8 8-24
AI
Lesson 9: Building Multiple Form Applications
& O
l
Introduction 9-3
a
rn
OPEN_FORM to Invoke Additional Forms 9-5
e
Int
Closing Forms 9-7
Navigating Between Forms 9-9
cle
Transaction Processing for Opened Forms 9-11
ra
CALL_FORM to Invoke Additional Forms 9-13
.....................................................................................................................................................
vi Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
ly
Manipulating Selected Record Group Rows 10-23
Defining Global Record Groups 10-25
On
e
Manipulating List Items Programmatically 10-27
Implementing Dynamic List Items 10-29
Us
Adding Values to Combo Boxes 10-31
AI
Summary 10-33
Practice Overview: Lesson 10 10-35
& O
al
Practice 10 10-36
ern
Int
Lesson 11: Using Reusable Components
Introduction 11-3
cle
Reusable Components 11-5
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II vii
Contents
.....................................................................................................................................................
ly
The Java Importer Tool 12-31
Summary 12-33
On
e
Practice Overview: Lesson 12 12-35
Practice 12 12-36
Us
Lesson 13: Using Server Features in Form Builder
AI
Introduction 13-3
& O
l
Using Oracle Database Server Functionality in Forms 13-5
a
rn
Dealing with PL/SQL Code 13-7
e
Int
PL/SQL8 Support 13-9
PL/SQL8 Scalar Data Types 13-11
cle
Unsupported Oracle Forms Developer PL/SQL8 Features 13-13
ra
Handling Errors Raised by the Oracle Database Server 13-15
.....................................................................................................................................................
viii Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
e O
s
Summary 15-23
Practice Overview: Lesson 15 15-25
I U
Practice 15 15-26
OA
Appendix A: Practice Solutions
l &
na
Practice 1 Solutions A-2
r
e
Practice 2 Solutions A-6
Int
Practice 3 Solutions A-9
cle
Practice 4 Solutions A-11
a
Practice 5 Solutions A-12
Or
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II ix
Contents
.....................................................................................................................................................
ly
S_PRODUCT Description B-17
S_PRODUCT Data B-18
On
e
S_REGION Description and Data B-22
S_TITLE Description and Data B-23
Us
Oracle8i Objects: Types, Tables B-24
AI
Appendix C: Mouse Movement Events
& O
l
Introduction C-2
a
rn
Drag and Drop C-4
e
Int
Summary C-6
le
Appendix D: Introduction to Oracle8i Object Features
c
a
Introduction D-3
Or
.....................................................................................................................................................
x Oracle iDS Forms: Build Internet Applications II
Contents
.....................................................................................................................................................
e O
Appendix G: EMP_PKG Package
Us
Package Specification G-2
AI
Package Body G-4
& O
al
Appendix H: Working with ActiveX Controls
rn
Introduction H-3
e
Int
What Are VBX, OCX, and ActiveX Controls? H-5
Comparison of VBX, OCX, and ActiveX Controls H-7
cle
ActiveX in Form Builder H-9
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II xi
Contents
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
.....................................................................................................................................................
xii Oracle iDS Forms: Build Internet Applications II
Preface
.................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Preface
.....................................................................................................................................................
Notes Page
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
.....................................................................................................................................................
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
OA
l &
rna
nte
e I
cl
ra
O
.....................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
.....................................................................................................................................................
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 Can’t 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
ly
titles of books SQL Language Reference Manual.
n
and courses,
Enter user_id@us.oracle.com, where
O
variables
user_id is the name of the user.
Quotation marks Interface elements
se
Select “Include a reusable module
with long names
U
component” and click Finish.
I
A
that have only This subject is covered in Unit II, Lesson 3,
O
initial caps; lesson “Working with Objects.”
&
and chapter titles in
l
cross-references
Uppercase
e
names, commands, information stored in the LAST_NAME
cle
ra
O
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II xvii
Preface
.....................................................................................................................................................
ly
you through Oracle Applications.
On
e
(N) Invoice—>Entry—>Invoice Batches Summary (M) Query—>Find
(B) Approve
Us
This simplified path translates to the following:
AI
1 (N) From the Navigator window, select Invoice—>Entry—>Invoice Batches
& O
Summary.
al
rn
2 (M) From the menu bar, select Query—>Find.
e
Int
3 (B) Click the Approve button.
cle
N = Navigator, M = Menu, B = Button
ra
O
.....................................................................................................................................................
xviii Oracle iDS Forms: Build Internet Applications II
................................
Introduction
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
9 Building Multiple Form Applications
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
I-4 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-3
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Menu
module
ly
Individual Menu Menu Individual
n
menu item item menu
e O
Menu
items
Us
Submenu
AI
& O Menu
items
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
s
your menu. For a menu module, you can have a vertical and a horizontal menu toolbar.
U
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-5
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Default Menu
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
1-6 Oracle iDS Forms: Build Internet Applications II
The Default Menu
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-9
Lesson 1: Creating a Menu Module
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
1-10 Oracle iDS Forms: Build Internet Applications II
Creating a Menu Module
......................................................................................................................................................
Creating a Submenu
se
1 Select the parent item on the individual menu.
I U
2 Click the Create Right icon.
OA
&
3 Replace the default label.
al
4 Select Menu—>Create Down to add another item to the submenu.
rn
5 Replace the default label.
e
nt
6 Repeat steps 4 and 5 to add more submenu items.
I
cle
ra
O
......................................................................................................................................................
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
®
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.)
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-13
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Menu Properties
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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)
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
1-16 Oracle iDS Forms: Build Internet Applications II
Menu Item Properties
......................................................................................................................................................
ly
Users can then issue the menu item command by pressing a key combination such as
n
[Alt] + [character].
r
Execute Query
nte
e I
cl
ra
O
......................................................................................................................................................
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
ly
• Copy • Window
• Cut
On
se
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.
ly
Clear Null Yes. These items perform the default
n
Copy operations indicated by their names.
O
Paste
e
Cut
Help Menu
UsNo. You must define a submenu to be
l
Quit Null Yes. The Quit command, by default, exits
l
Users can activate a window by selecting
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-19
Lesson 1: Creating a Menu Module
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
n
I
and select PL/SQL Editor from the pop-up menu.
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
Visible in Vertical Specifies that the menu item should appear (represented by an
Menu Toolbar icon) on the vertical toolbar of a form
On
Icon Filename
e
Specifies the name of the icon resource that you want to represent
s
U
the iconic button. For Web-deployed forms, this should be a GIF
I
file, otherwise use an ICO file.
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-23
Lesson 1: Creating a Menu Module
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
1-26 Oracle iDS Forms: Build Internet Applications II
Attaching the Menu Module
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-27
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Us
I
with a pop-up menu property
• Pre-Popup-Menu trigger provides
dynamic control
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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 menu’s 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.
e O
s
• Pop-up menu items can be parents of submenus (if the platform allows
it), magic menu items, or separators.
I U
Pre-Popup-Menu Trigger
OA
&
You can use this trigger to add dynamic control at run time, prior to displaying the
al
menu. For example, you can use the trigger to identify the cursor context and navigate
rn
to a different item if necessary.
e
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-29
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
• Database tables
n
• .mmb file extension
• .mmx file extension
e O
• .mmt file extension
Us
Menu Module and Form Module Association
AI
Using the form module properties of Menu Module and Menu Source
& O
al
Creating a Pop-up Menu
rn
• Incorporate pop-up menus
e
nt
• Rules to incorporate pop-up menus
I
e
• Pre-Popup-Menu trigger
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-31
Lesson 1: Creating a Menu Module
......................................................................................................................................................
Practice 1 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
Menu
n
Toolbar Filename
Save Plain PL/SQL DO_KEY(’CO
s
MMIT_FORM’
U
);
Clear Plain PL/SQL DO_KEY(’
AI Yes Yes Abort
CLEAR_FORM
’);
& O
Null1
al
Separator Null Yes Yes
ern
t
Exit Plain PL/SQL DO_KEY( Yes Yes Exit
In
’EXIT_FORM
e
’);
cl
a
Null2 Separator Null No Yes
Or
......................................................................................................................................................
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
O
’sales_rep_id’ ) ;
se
U
• Query Menu
AI
O
Visible in
Menu Command Horiz. Menu Icon
Label
l
Item Type Type
&
Menu Item Code Toolbar Filename
Enter
rna Plain PL/SQL DO_KEY(’ Yes query
Query
nte ENTER_QUERY’);
e I
eXe- Plain PL/SQL DO_KEY(’EXECUT Yes execute
l
cute E_QUERY’);
racQuery
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 1-35
Lesson 1: Creating a Menu Module
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
1-36 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-3
Lesson 2: Managing Menu Modules
......................................................................................................................................................
nly
O
– Must use NAME_IN built-in function
– Cannot use direct assignment for
form objects
se
– Must use COPY built-in procedure
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.
nly
O
• You cannot use direct assignment to set the value of a form module
object.
se
U
• You must use the COPY built-in procedure.
Example
AI
IF :s_emp.title = ’MANAGER’ THEN ...-- INCORRECT
& O
al
IF NAME_IN(’s_emp.title’) = ’MANAGER’ THEN ... -- CORRECT
n
:s_product.name := ’PUMP’; -- INCORRECT
ter
COPY(’PUMP’, ’s_product.name’); -- CORRECT
In
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
O
mi_id := Find_Menu_Item(’Preferences.AutoCommit’);
e
/* Determine the current checked state of the AutoCommit menu
checkbox item and toggle the checked state */
Us
I
IF Get_Menu_Item_Property(mi_id,CHECKED) = ’TRUE’ THEN
ELSE
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_FALSE);
OA
l
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_TRUE);
&
na
END IF;
r
e
END;
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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;
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-9
Lesson 2: Managing Menu Modules
......................................................................................................................................................
What Is a Role?
Users
nly
O
Role
se
I U
OA
l
Privileges
&
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.
ly
2 Choose roles for the module in Form Builder.
n
3 Assign access to menu items.
4 Set the Use Security property.
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-11
Lesson 2: Managing Menu Modules
......................................................................................................................................................
nly
e O
Us
AI
& O
al
rn
®
Technical Note
nte
e I
l
If Use Security is modified, you must recompile the menu module.
rac
O
......................................................................................................................................................
2-12 Oracle iDS Forms: Build Internet Applications II
Defining Security Roles
......................................................................................................................................................
AI
O
When Use Security is set to No:
• Forms ignores security.
l &
rna
• Your users can access all menu items.
e
• You can test your application without being a member of all roles.
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-13
Lesson 2: Managing Menu Modules
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
2-14 Oracle iDS Forms: Build Internet Applications II
Assigning Access to Menu Items
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-15
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 2-17
Lesson 2: Managing Menu Modules
......................................................................................................................................................
Practice 2 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
Us
I
b Modify the startup code of the M_SUMMIT menu module to hide
the SORT_BY menu when the CUSTOMERS form is opened. You
can import the code from the pr2_3.txt file to replace the
OA
l
existing code. You may need to change the code to conform to the
&
rna
exact names you gave to the Main Menu and its menu items. Also,
be sure the When-Button-Pressed trigger on the Orders button refers
te
to your Orders form.
n
I
c Save and compile the menu module.
e
cl
d Deploy your CUSTOMERS form to the Web and test your
ra
application. Execute a Query and click the Orders button to move to
O the ORDERS form. Note that the Sort_By menu item is hidden when
the CUSTOMERS form is current, and is visible when the ORDERS
form is current.
4 With both the ORDERS and CUSTOMERS form modules, restore the
default menu, (DEFAULT&SMARTBAR).
......................................................................................................................................................
2-20 Oracle iDS Forms: Build Internet Applications II
................................
Programming
Function Keys
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 3: Programming Function Keys
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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;
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
associated with the key.
Example
On
The following form-level Key-Menu trigger disables [Block Menu] for a
se
U
form.
BEGIN
AI
NULL;
END;
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-5
Lesson 3: Programming Function Keys
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
3-6 Oracle iDS Forms: Build Internet Applications II
Defining Key Triggers
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-7
Lesson 3: Programming Function Keys
......................................................................................................................................................
[Accept] COMMIT_FORM
nly
Key-Commit
Us
I
[Create Record] CREATE_RECORD Key-Crerec
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
3-8 Oracle iDS Forms: Build Internet Applications II
Characteristics of Key Triggers
......................................................................................................................................................
ly
[Enter Query] ENTER_QUERY Key-Entqry
[Execute Query]
[List]
EXECUTE_QUERY
LIST_VALUES
On Key-Exeqry
Key-Listval
[Next Item] NEXT_ITEM
se Key-Next-Item
[Down] DOWN
I U Key-Down
A
[Next Record] NEXT_RECORD Key-Nxtrec
[Exit] EXIT_FORM
& O Key-Exit
l
Note: This list is incomplete.
a
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-13
Lesson 3: Programming Function Keys
......................................................................................................................................................
nly
O
Adjust toolbar buttons for Enter Query mode
se
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
ly
Key-Duprec
• Adjust behavior of toolbar buttons when Enter Query mode is entered or
On
e
left, using Key-Entqry
Technical Note
Us
To determine if a Key-Others trigger applies to a function key, Forms looks
AI
for associated key triggers at all levels. For example, if you define the
& O
Key-Others trigger at the block level, it will not fire for those function keys
al
for which a key trigger is defined at the form level.
ern
Int
cle
ra
O
......................................................................................................................................................
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;
...
...
e O
s
• Corresponding interface control
U
descriptions
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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’);
ly
Interface Control Descriptions
If the same functionality is activated by various interface controls, you
On
e
should also make sure that the controls have the same descriptions.
Interface Control Property for Description
Us Changeable at Run Time?
Function key Show keys description
AI No
Menu item
Button
Menu-item label
Button label
& O Yes
Yes
Mouse event
al Not applicable Not applicable
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-17
Lesson 3: Programming Function Keys
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 3-19
Lesson 3: Programming Function Keys
......................................................................................................................................................
Practice 3 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
ly
a Add the following code to your key trigger:
call_form(’custquery’,no_hide);
On
e
execute_query;
b The CUSTQUERY form will return three values, held in global
Us
variables. The contents should be passed to your CUSTOMERS
form to allow the user to execute a restricted query. Use the
AI
following global variables:
& O
l
:global.custid;
a
n
:global.custname;
ter
:global.repid;
c
In
Define the global variables in your CUSTOMERS form to ensure
le
that the user can perform unrestricted queries.
c
a
d Save and compile your CUSTOMER form. Deploy your form to the
Or Web to test.
......................................................................................................................................................
3-22 Oracle iDS Forms: Build Internet Applications II
................................
Responding to Mouse
Events
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
4-2 Oracle iDS Forms: Build Internet Applications II
Introduction
......................................................................................................................................................
Introduction
Overview
The keyboard, menu, and mouse are the operator’s 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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-3
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Mouse Events
SET_APPLICATION_PROPERTY(CURSOR_STYLE,
′value′);
nly
O
DEFAULT GUI-specific arrow symbol
BUSY GUI-specific busy symbol
se
CROSSHAIR GUI-specific crosshair symbol
I U
A
HELP GUI-specific help symbol
INSERTION GUI-specific insertion symbol
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
4-4 Oracle iDS Forms: Build Internet Applications II
What Are Mouse Events?
......................................................................................................................................................
ly
following built-in to do it:
n
SET_APPLICATION_PROPERTY( CURSOR_STYLE, ’value’);
The valid settings for the cursor style property are:
e O
• BUSY
Us
I
• CROSSHAIR
• DEFAULT
OA
&
• HELP
• INSERTION
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-5
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
When-Mouse-Enter
When-Mouse-Leave
When-Mouse-Move
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
4-6 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Movement
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
Technical Note
The SYSTEM.MOUSE_FORM system variable is NULL if the platform is
not a GUI platform.
On
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
4-8 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Movement
......................................................................................................................................................
ly
top left corner of the item.)
On
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
4.
s
When-Mouse-Down
I U
5. When-Mouse-Up
OA
6.
l
When-Mouse-Doubleclick
&
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
Technical Note
nte
e I
l
Click and double-click work only if the mouse stays on the item (or canvas)
rac
throughout the down-up action.
......................................................................................................................................................
4-10 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Button Actions
......................................................................................................................................................
l
button trigger. Even though you may not have defined the relevant mouse
a
n
button trigger, the user interface will generate this event if you have defined
er
at least one mouse button trigger in your form. You should therefore restrict
t
In
use of mouse button triggers.
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
4-12 Oracle iDS Forms: Build Internet Applications II
Responding to Mouse Button Actions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-13
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
• Mouse button triggers
- When-Mouse-Click
On
e
- When-Mouse-Doubleclick
- When-Mouse-Up
Us
- When-Mouse-Down
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 4-15
Lesson 4: Responding to Mouse Events
......................................................................................................................................................
Practice 4 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
4-18 Oracle iDS Forms: Build Internet Applications II
................................
Controlling Windows
and Canvases
Programmatically
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-3
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
System Variable
:SYSTEM.EVENT_WINDOW
Trigger Use
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-4 Oracle iDS Forms: Build Internet Applications II
Using Window-Interaction Triggers
......................................................................................................................................................
ly
Keeping Track of the Triggered Window
The SYSTEM.EVENT_WINDOW system variable contains the name of the last
O
window for which a window-interaction trigger fired. You can use this system variablen
se
to perform different actions for different windows in your window-interaction triggers.
I U
Note: Help with triggers is available by pressing [Ctrl] + [H] and selecting PL/SQL
Reference - Triggers.
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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
ly
the Forms Applet WIDTH and HEIGHT parameters in the base HTML page.
n
Definition of these Form Applet parameters is covered later in this course.
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-6 Oracle iDS Forms: Build Internet Applications II
Built-ins for Manipulating Windows
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-8 Oracle iDS Forms: Build Internet Applications II
Built-ins for Manipulating Canvases
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-9
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
• Clicks a tab
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
5-10 Oracle iDS Forms: Build Internet Applications II
Working with Tab-Style Canvases
......................................................................................................................................................
Technical Note
ly
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
On
se
other tab pages without navigating the cursor and therefore causing item navigation
and validation (as previously mentioned).
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-11
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
If GET_CANVAS_PROPERTY(’custab’,
nly
TOPMOST_TAB_PAGE)= ’Billing’ then
e O
SET_CANVAS_PROPERTY(’custab’,
Us
I
TOPMOST_TAB_PAGE,
A
’Address’);
end if;
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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;
&
In the preceding syntax example, page_name is either a constant, in single quotes, or
l
a
a variable.
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-13
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Window 2
Block 2
Block 3
Cursor
location
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
O
usesdi=yes
With SDI window applications, you must size form module windows to allow for the
se
U
menu, menu toolbar, and console bar to display.
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-16 Oracle iDS Forms: Build Internet Applications II
Manipulating Window Properties Programmatically
......................................................................................................................................................
ly
NAME_IN(’system.cursor_item’),item_canvas),
n
window_name));
O
END;
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-17
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
ly
IF :SYSTEM.EVENT_WINDOW = get_cursor_window THEN
RETURN;
ELSIF :SYSTEM.EVENT_WINDOW = ’WINDOW1’ THEN
On
GO_BLOCK(’s_dept’);
se
U
ELSIF :SYSTEM.EVENT_WINDOW = ’WINDOW2’ THEN
I
GO_BLOCK(’s_emp’);
END IF;
END;
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-19
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
WIDTH=650
HEIGHT=400
usesdi=no
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-21
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
usesdi=yes
separateFrame=true
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-23
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-24 Oracle iDS Forms: Build Internet Applications II
Display Large Data Blocks in a Window
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-25
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Managing Images
for Web-Deployed Forms
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-27
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Summary
Summary
nly
O
– Transaction management is block-oriented.
• Manage Windows in Web-deployed forms
se
U
– MDI and SDI windows
– Sizing the Applet area
AI
– Managing Images
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.
ly
Web-deployed Forms
• MDI and SDI windows
• Applet Areas
On
• Separate frames
se
• Display Large Data Blocks
I U
• Splash Screens and Background Images
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 5-29
Lesson 5: Controlling Windows and Canvases Programmatically
......................................................................................................................................................
Practice 5 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
If you have time
e O
3 How can you ensure that the user is returned to the first navigable item
Us
within a tab page after navigating from the last navigable item?
AI
4 How can you enforce item navigation dynamically within a tab page?
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
5-32 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 6: Defining Data Sources
......................................................................................................................................................
Objectives
Objectives
nly
O
Return a table of records from a stored procedure
• Select the appropriate data source for a
data block
se
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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...)
ly
• Improves developer productivity
•
•
Reduces the burden on the DBA
On
e
Improves performance
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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 ;
AI
O
Note: The FROM clause query produces results that are identical to an
&
updatable join-view from the client side, but for which there is no defined
l
view on the server.
a
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-7
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
s
Procedure Updating Data block
O
Company Code:
1235 Smith Clerk 01-Jan-95 Company Name:
Code:
Balance:
&
1236 Adams Clerk Balance:
01-Jan-95
l
1237 Clark Clerk 01-Jan-95
nte
e I
cl
ra
O
......................................................................................................................................................
6-8 Oracle iDS Forms: Build Internet Applications II
Basing a Data Block on a Stored Procedure
......................................................................................................................................................
ly
series of rows from a table.
Unlike a view or a REF cursor, you are not limited to what you can express
On
e
as a SQL SELECT statement. Anything you can code in PL/SQL is possible;
for example, a tree-walk that includes a join.
Us
Using a table of records is extremely efficient in terms of the savings on
AI
network traffic because it takes a single round-trip (from client to server) to
execute the stored procedure and a single round-trip to return the records.
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-9
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
6-10 Oracle iDS Forms: Build Internet Applications II
Example of a Query Using a REF Cursor Procedure
......................................................................................................................................................
nly
O
FROM emp
e
WHERE deptno = NVL( p_deptno, deptno )
ORDER BY empno;
Us
I
END;
END;
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-11
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
6-12 Oracle iDS Forms: Build Internet Applications II
Example of Query Using a Table of Records Procedure
......................................................................................................................................................
ly
FROM emp
WHERE deptno = NVL( p_deptno, deptno );
BEGIN
On
OPEN empsel;
se
i := 1;
I U
A
LOOP
FETCH empsel INTO block_data(i).empno,
& O
l
block_data(i).ename;
e
i := i + 1;
e
END;
cl END;
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
6-14 Oracle iDS Forms: Build Internet Applications II
Example of DML Using a Stored Procedure
......................................................................................................................................................
nly
O
FOR i IN 1..cnt LOOP
e
INSERT INTO emp (empno, ename, mgr, deptno)
VALUES (block_data(i).empno, block_data(i).ename,
Us
I
block_data(i).mgr, block_data(i).deptno);
END LOOP;
END;
OA
END;
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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
ly
Procedure
1 2
n
Query Cursor
e O
Us
I
Cursor
3
OA
&
Table of records
al 4
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
6-16 Oracle iDS Forms: Build Internet Applications II
Deciding Whether to Use a REF Cursor or a Table of Records
......................................................................................................................................................
ly
• REF cursor: The number of records fetched depends on the Array Fetch
property value.
• Table of records: All records are fetched.
On
If you want to view all records, a table of records is more efficient. However,
se
I
if the table of records returns 10,000 records and you look only at 3, it is not
U
an efficient option. For querying and DML, you use an unnecessary amount
of memory because all the rows must be in memory at the same time.
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-17
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-19
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.)
ly
(Insert, Update, Delete, Lock) Specifies the name of the procedure to be used (Used
Procedure Name
n
only if the DML data target type is Procedure.)
O
(Insert, Update, Delete, Lock)
e
Specifies the names and data types of the
s
U
Procedure Result Set Columns result set columns associated with the
I
procedure (Used only if the DML data
A
target type is Procedure.)
O
&
(Insert, Update, Delete, Lock) Specifies the names, data types, and values
al
Procedure Arguments of the arguments that are to be passed to the
n
procedure (Used only if DML data target
In
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-21
Lesson 6: Defining Data Sources
......................................................................................................................................................
e O
s
• Perform validation and DML on the
U
server side
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
6-22 Oracle iDS Forms: Build Internet Applications II
Data Source Guidelines
......................................................................................................................................................
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-23
Lesson 6: Defining Data Sources
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
6-24 Oracle iDS Forms: Build Internet Applications II
Data Source Guidelines
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-25
Lesson 6: Defining Data Sources
......................................................................................................................................................
Summary
Summary
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
6-26 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
New Data Sources
• Stored procedure (query and DML)
• FROM clause query (query only)
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 6-27
Lesson 6: Defining Data Sources
......................................................................................................................................................
Practice 6 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
6-30 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-4 Oracle iDS Forms: Build Internet Applications II
What Are Object Types?
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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;
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
O
cannot be modified directly through SQL DML statements (INSERT,
UPDATE, and DELETE). These triggers are called INSTEAD-OF triggers
se
U
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.
AI
& O
l
Technical Note
na
The Database Trigger Editor includes the INSTEAD-OF triggering event.
r
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-7
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
References to Objects
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-9
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-10 Oracle iDS Forms: Build Internet Applications II
Supported Oracle8i Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-12 Oracle iDS Forms: Build Internet Applications II
How Oracle Forms Developer Treats Objects
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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,
ly
salary NUMBER(11,2),
commission_pct NUMBER(4,2) );
On
-- ref column
se
CREATE TABLE rel_emp_table_RefCol (
I U
A
id NUMBER(7), last_name VARCHAR2(25),
first_name VARCHAR2(25), userid
start_date DATE,
VARCHAR2(8),
manager_id NUMBER(7), title
& O
al
VARCHAR2(25), dept_id REF dept_type,
salary
ern
NUMBER(11,2),
t
commission_pct NUMBER(4,2) );
In
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-15
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-16 Oracle iDS Forms: Build Internet Applications II
Creating Data Blocks Based on Oracle8i Objects
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-17
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-18 Oracle iDS Forms: Build Internet Applications II
Selecting Object Table Columns
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-19
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-20 Oracle iDS Forms: Build Internet Applications II
Selecting Object Column Attributes
......................................................................................................................................................
ly
title VARCHAR2(25),
dept_id
salary
dept_type,
NUMBER(11,2),
On
commission_pct NUMBER(4,2) );
se
In the diagram, the wizard displays ID, NAME, and REGION_ID as
I U
A
columns you can select as data block items.
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-21
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-22 Oracle iDS Forms: Build Internet Applications II
Blocks with REF Lookups
......................................................................................................................................................
ly
commission_pct NUMBER(4,2) );
As seen in the diagram, the REF column name (DEPT_ID) appears twice in
the column selection list. It appears once as a heading for the referenced
On
object’s attributes and then again as a pointer. The column is selectable.
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-23
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-24 Oracle iDS Forms: Build Internet Applications II
The REF Column Value
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-25
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
7-26 Oracle iDS Forms: Build Internet Applications II
LOVs for REFs
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-27
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 7-29
Lesson 7: Working with Oracle8i Objects in Form Builder
......................................................................................................................................................
Practice 7 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
ly
d Select the DEPT_ID attributes ID and NAME.
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.
On
f In the Layout Wizard, select all available items for display.
se
g In the Object Navigator, identify the canvas with which item
I U
DEPT_ID is associated.
OA
&
h In the Object Navigator, check that an LOV and associated record
l
group have been created.
a
rn
i Save, compile, and test the form.
e
Int
cle
ra
O
......................................................................................................................................................
7-32 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-3
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Relations
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
er
coordination.
t
In
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-7
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
8-8 Oracle iDS Forms: Build Internet Applications II
Coordinate Blocks Using REFs
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
8-10 Oracle iDS Forms: Build Internet Applications II
Characteristics of Relation-Handling Triggers
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-11
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
8-12 Oracle iDS Forms: Build Internet Applications II
Principles of Relation-Handling Code
......................................................................................................................................................
e O
s
--
You can add PL/SQL code to relation-handling triggers before the “Begin
I U
default relation program section” comment or after the “End default relation
program section” comment.
OA
l
Note: Forms will not delete a relation-handling trigger to which you have
&
rna
properly added PL/SQL code.
nte
e I
cl
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
8-14 Oracle iDS Forms: Build Internet Applications II
Obtaining Relation-Handling Information
......................................................................................................................................................
ly
FIRST_DETAIL_RELATION,
n
FIRST_MASTER_RELATION
GET_RELATION_PROPERTY
O
AUTOQUERY(*),
e
DEFERRED_COORDINATION(*),
Us
MASTER_DELETES(*),
AI
PREVENT_MASTERLESS_OPERATION(*),
DETAIL_NAME, MASTER_NAME,
O
NEXT_DETAIL_RELATION,
&
l
NEXT_MASTER_RELATION
rna
(*): You can also set those properties using the Set-Relation-Property built-
in.
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
8-16 Oracle iDS Forms: Build Internet Applications II
Implementing a Coordination-Type Toggle
......................................................................................................................................................
ly
END IF;
n
END IF;
O
END toggle_query_sync;
.
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-17
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
8-18 Oracle iDS Forms: Build Internet Applications II
Forcing a Commit Per Master
......................................................................................................................................................
ly
RAISE form_trigger_failure;
n
END IF;
O
END check_master_change;
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-19
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Summary
Summary
nte
e I
cl
ra
O
......................................................................................................................................................
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.
e O
Obtaining Relation-Handling Information
Us
• There are two system variables for relation handling.
AI
• You can use built-ins for relation handling to get relation names and to
get or set relation properties.
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-21
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
Practice 8 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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:
nly Y
DataBase Item No
e O No
Canvas TOOLBAR
Us TOOLBAR
& O
l
c Make sure that the first check box enables a user to toggle between
na
immediate coordination and deferred coordination. You can import
r
e
the code from the pr8_1.txt file.
Int
d Make sure that the second check box enables a user to toggle
e
between automatic query and no automatic query for the detail
cl
block. This check box should be disabled if the other check box
raindicates immediate coordination. You can import the code from the
O pr8_2.txt file.
e Save, compile, and test your form.
......................................................................................................................................................
8-24 Oracle iDS Forms: Build Internet Applications II
Practice 8
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 8-25
Lesson 8: Controlling Data Block Relationships
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
8-26 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Objectives
Objectives
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
• Session run time option: FORMS60_SESSION
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
e O
s
Create a package that contains the PL/SQL variables to be shared, and place the
U
package in a library. Attach the library to all the forms that are to share the data. In the
OPEN_FORM command, set the data_mode parameter to
AI
O
SHARE_LIBRARY_CODE. Any changes made by one form are visible to the other
&
forms. This method of sharing data between forms is preferable to global variables
l
because the PL/SQL variables benefit from PL/SQL’s strong typing and because PL/
a
n
SQL variables are stored and accessed more efficiently than global variables.
ter
In
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
......................................................................................................................................................
•
between forms.
nly
O
No triggers fire when navigating
e
between forms, except the When-Window-
s
Activated/Deactivated and
When-Form-Navigate triggers.
I U
A
• Click the noncurrent item in the other form.
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
9-8 Oracle iDS Forms: Build Internet Applications II
Navigating Between Forms
......................................................................................................................................................
ly
• When you are navigating between (current items of) open forms, no
triggers fire. The only exceptions are the When-Window-Activated,
When-Window-Deactivated, and When-Form-Navigate triggers. Even
On
the navigational triggers do not fire when you are navigating between
se
open forms.
I U
• The triggers that typically fire when you navigate from the current item
to the target item will fire when you click a noncurrent item of an open
OA
form. When this happens, navigational triggers also fire and validation
l &
rna
occurs as required.
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-9
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Connection
Runform Server
ly
A
On
e
B
Us
C
AI
& O
al Session
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
9-10 Oracle iDS Forms: Build Internet Applications II
Transaction Processing for Opened Forms
......................................................................................................................................................
ly
forms in different sessions is the same as it would be for two independent forms with
separate connections.
• You can turn the Session option on for all Runtime invocations by
On
setting the FORMS60_SESSION environment variable to True.
se
• Forms Runtime must be running with the Session option turned on when
I U
you execute OPEN_FORM with the SESSION_MODE parameter set to
SESSION.
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
• Does not cause navigation and validation
e O
s
• Forms called from query-only form are
U
always query-only
• Exiting a called form
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
• Is valid in Enter Query mode
e O
s
• Causes Forms to issue a savepoint
• Causes called form to be modal
I U
• Does not cause navigation or validation in the initial form
• Can call a form in Query Only mode
OA
l
• Propagates query-only parameter through all subsequent called forms &
rna
• Returns control to the calling form and resumes processing of the
te
PL/SQL code at the statement immediately following the calling
n
I
statement (This occurs when Forms exits the called form.)
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-13
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Transaction Processing
for Called Forms
•
rollback to savepoint
nly
O
Rollback behavior of called forms
• Call savepoints and post savepoints
se
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
9-14 Oracle iDS Forms: Build Internet Applications II
Transaction Processing for Called Forms
......................................................................................................................................................
ly
If a user exits from a called form, Form Builder issues a rollback to the call savepoint
n
that was set when the form was called. This means that all changes posted in the called
form are rolled back upon exit from the called form. This is because of the
EXIT_FORM built-in default arguments:
e O
EXIT_FORM(ask_commit, to_savepoint);
Us
AI
Do not confuse call savepoints, which are set when a form is called or started, with
post savepoints, which are set at the start of a post.
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
ly
IF <form called> THEN
n
EXIT_FORM(ASK_COMMIT, NO_ROLLBACK);
EXIT_FORM
O
ELSE
e
EXIT_FORM;
END IF;
Us
Adjust labels of corresponding buttons and menu items
AI
& O
al
ern
t
®
In
cle
ra
O
......................................................................................................................................................
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;
ly
END IF;
n
END;
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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);
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
9-20 Oracle iDS Forms: Build Internet Applications II
Controlling Open Forms and Called Forms Together
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-21
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
9-22 Oracle iDS Forms: Build Internet Applications II
Different Ways of Invoking Forms
......................................................................................................................................................
AI
another form. An additional Forms run-time session, however, will be generated.
O
In order to run many forms within one Web-deployed Forms run-time session, use
&
l
OPEN_FORM, CALL_FORM or NEW_FORM.
na
Calling forms will impose a burden on client and Web Server memory. If it is unlikely
r
e
that the user will return to the calling form, (such as a login form), use NEW_FORM.
nt
If the user will continue to use the calling form, then OPEN_FORM will save the
I
startup delay and use of network resources that reloading the form would otherwise
cle
incur.
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-23
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Runform
Form B
command line
Design-time
ly
parameters
Form A P1
On
e
P2
Run time
P3
Us
Parameter
OPEN_FORM
CALL_FORM
AI
O
list NEW_FORM
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
9-24 Oracle iDS Forms: Build Internet Applications II
Using Form Parameters
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-25
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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;
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
9-30 Oracle iDS Forms: Build Internet Applications II
Creating and Manipulating Parameter Lists
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-31
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
e O
s
• Characteristics of global variables:
– Are programmatic constructs
I U
A
– Have type CHAR(255)
– Are visible to all forms in the current
Runform session
& O
al
rn
®
Technical Note
nte
e I
l
Global variables are used more often than parameters for passing data between forms.
rac
O
......................................................................................................................................................
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.
& O
l
- Global variables are always programmatic constructs of type
rna
CHAR(255). They are visible to all the forms in the current Runform
session.
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-33
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Summary
Summary
Us
– Referencing form parameters
AI
O
– Text parameters and Data parameters
&
– Built-ins for parameter lists
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
9-34 Oracle iDS Forms: Build Internet Applications II
Summary
......................................................................................................................................................
Summary
The Three Built-ins for Invoking Forms
• OPEN_FORM
• CALL_FORM
• NEW_FORM
e O
Using Form Parameters
Us
• Passing parameter values to a form by way of Runform command line or
AI
O
parameter list
• Referencing form parameters using PARAMETER.parameter_name
l &
na
Using Parameter Lists
r
te
• The two parameter types: text parameters and data parameters
n
I
• The default parameter list named DEFAULT
e
cl
• Built-ins for creating and manipulating parameter lists
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-35
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
Practice 9 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
ly
opened by ‘CALL_FORM’, that a [Commit Form] performs a POST.
c Ensure that updates in SALESREP are not cleared when the user
On
e
exits the form.
d Save and compile your form. Deploy your form to the Web to test.
Us
3 The SALESREP form displays a list of all employees; modify your
AI
application to ensure that only Sales Representatives are displayed when
& O
l
the form is called from CUSTOMERS.
a
ern
a Create a parameter called ‘EVERYONE’ in the SALESREP form.
t
Specify a default value of ‘Y’.
In
cle
ra
O
......................................................................................................................................................
9-38 Oracle iDS Forms: Build Internet Applications II
Practice 9
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 9-39
Lesson 9: Building Multiple Form Applications
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
9-40 Oracle iDS Forms: Build Internet Applications II
................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
Lesson 10: Working with Record Groups
......................................................................................................................................................
Objectives
Objectives
nly
O
• Manipulate list items programmatically
• Implement dynamic list items
se
U
• Add values to combo boxes
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-3
Lesson 10: Working with Record Groups
......................................................................................................................................................
Record Groups
Record Groups
nly
...
...
e O
s
IF
IF Get_LOV_Property(lov_id,GROUP_NAME)
Get_LOV_Property(lov_id,GROUP_NAME) == ’GROUP1’
’GROUP1’
U
THEN
I
THEN
Set_LOV_Property(lov_id,GROUP_NAME,’GROUP2’);
A
Set_LOV_Property(lov_id,GROUP_NAME,’GROUP2’);
END
END IF;
O
IF;
...
...
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-6 Oracle iDS Forms: Build Internet Applications II
Using Record Groups
......................................................................................................................................................
ly
You can create a global record group at run time that is visible to all forms in
n
an application.
ern
You can transfer the values of a record group to a list item. Because the
nt
record group may be based on a dynamically constructed SELECT
I
e
statement, this ability gives you the opportunity to create dynamic list items.
cl
The data transfer is bidirectional; you can also transfer the values of a list
ra
item to a record group. (This can be considered “storing” the list item.)
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-7
Lesson 10: Working with Record Groups
......................................................................................................................................................
nly
e O
Us
AI
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
10-8 Oracle iDS Forms: Build Internet Applications II
Defining Record Groups at Design Time
......................................................................................................................................................
nly
O
Modifying the SELECT Statement of a Query Record Group
1 In the Object Navigator, select the desired record group.
se
U
2 In the Properties window, call the Editor from the Record Group Query
property.
AI
3 Modify the SELECT statement as desired and then click OK.
& O
l
Modifying the Column Definitions of a Record Group
a
rn
1 In the Object Navigator, select the desired record group.
e
Int
2 In the Properties window, double-click the Column Specifications
property. Forms displays the Column Specification dialog box.
le
3 Select a column and modify its Data Type, Length, and Column Values
c
ra
properties as desired and then click OK.
......................................................................................................................................................
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
ly
1 201 Unisports
2
3
4
203 Delhi Sports
204 Womansport
On
se
U
DELETE_GROUP_ROW
AI
ADD_GROUP_COLUMN
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
10-10 Oracle iDS Forms: Build Internet Applications II
Built-in Functions for Controlling Record Groups
......................................................................................................................................................
ly
DELETE_GROUP_ROW Deletes the specified row or all rows of the
n
given record group
O
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-11
Lesson 10: Working with Record Groups
......................................................................................................................................................
ID Name
SET_GROUP_CHAR_CELL
nly
e O
Us
AI
O
GET_GROUP_NUMBER_CELL
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
Technical Note
nte
e I
l
POPULATE_GROUP built-in function returns 0 when population succeeds
rac
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.
ly
GET_GROUP_DATE_CELL, identified by the given record group column
n
GET_GROUP_NUMBER_CELL and row number (The record group column
e O
must be of data type VARCHAR2 or LONG,
DATE, or NUMBER, respectively.)
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
®
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-14 Oracle iDS Forms: Build Internet Applications II
Built-in Functions for Controlling Record Groups
......................................................................................................................................................
ly
name (Note that this name must include the record group name as
n
a prefix. This function can also be used for group columns created
O
at design time.)
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-15
Lesson 10: Working with Record Groups
......................................................................................................................................................
Yes ID NULL? No
Populate group
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-16 Oracle iDS Forms: Build Internet Applications II
Defining Query Record Groups Programmatically
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-17
Lesson 10: Working with Record Groups
......................................................................................................................................................
Yes ID NULL? No
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-18 Oracle iDS Forms: Build Internet Applications II
Defining Nonquery Record Groups Programmatically
......................................................................................................................................................
ly
SET_GROUP_CHAR_CELL(v_gc2_id,1,:cus.name);
END;
You can convert the nonquery record group into a query record group by
On
calling the POPULATE_GROUP_WITH_QUERY built-in function.
se
I U
OA
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-20 Oracle iDS Forms: Build Internet Applications II
Manipulating Record Group Rows
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-22 Oracle iDS Forms: Build Internet Applications II
Manipulating Selected Record Group Rows
......................................................................................................................................................
ly
v_grprow_no NUMBER;
n
BEGIN
O
--Only loop through the selected group rows.
e
v_grpsel_count := GET_GROUP_SELECTION_COUNT(p_rg_id);
s
FOR v_grpsel_no IN 1 .. v_grpsel_count LOOP
--Get row number of selected row.
I U
A
v_grprow_no := GET_GROUP_SELECTION(p_rg_id,v_grpsel_no);
O
IF GET_GROUP_CHAR_CELL(p_gc_id,v_grprow_no) = p_value THEN
RETURN(v_grpsel_no);
l
END IF;
&
a
END LOOP;
rn
RETURN(null);
e
t
END;
In
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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
nly
e O
s
POPULATE_LIST RETRIEVE_LIST
I U
A
CHAR Column 1 CHAR Column 2
& O
al
rn
®
nte
e I
cl
ra
O
......................................................................................................................................................
10-26 Oracle iDS Forms: Build Internet Applications II
Manipulating List Items Programmatically
......................................................................................................................................................
ly
the given list item and stores them in the specified
n
record group
&
these requirements:
al
• The record group must contain exactly two group columns of type
CHAR.
ern
t
• The first group column must store the list element label.
In
• The second group column must store the list element value.
cle
ra
O
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-28 Oracle iDS Forms: Build Internet Applications II
Implementing Dynamic List Items
......................................................................................................................................................
Us
I
END;
Note: In this example, the customer name is the (visible) list label and the
customer ID is the (actual) list value.
OA
l &
rna
Technical Note
Because a base table list item must specify a value for either the Initial
te
property or the Mapping of Other Values property, the record group used to
n
I
dynamically populate a list item must also contain this value. Be sure the
e
l
record group query returns this value. For more information, see Note
c
a
1010798.6, available on MetaLink: http://www.metalink.oracle.com.
Or
......................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-30 Oracle iDS Forms: Build Internet Applications II
Adding Values to Combo Boxes
......................................................................................................................................................
e
END;
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-31
Lesson 10: Working with Record Groups
......................................................................................................................................................
Summary
Summary
e O
s
– Built-in functions for list items
I U
OA
l &
rna Copyright Oracle Corporation, 2001. All rights reserved.
®
nte
e I
cl
ra
O
......................................................................................................................................................
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.
e O
Uses for Record Groups
Us
• Constructing dynamic SELECT statements
AI
• Storing form configuration information
• Communicating within a form
& O
al
• Passing data to other Oracle products
ern
• Populating or storing list items
Int
Manipulating List Items Programmatically
cle
Built-in for list items
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-33
Lesson 10: Working with Record Groups
......................................................................................................................................................
Practice 10 Overview
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
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.
ly
e Call the procedure each time a new record is created.
f Save and compile your form module to test.
On
se
U
If you have time
2 Replace the design-time query record group in the Employee form with
AI
O
a run-time query-based record group.
l &
rna
nte
e I
cl
ra
O
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications II 10-37
Lesson 10: Working with Record Groups
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
cle
ra
O
......................................................................................................................................................
10-38 Oracle iDS Forms: Build Internet Applications II