Transcript here
Introduction to Oracle 10g
Chapter 9
Customizing Forms
James Perry and Gerald Post
9-1
© 2007 by Prentice Hall
Chapter Outline
•
•
•
•
•
9-2
Setting the Form Structure
Designing Form Triggers
Creating Useful Forms Tools
Using Multiple Canvases
Creating Web Forms with JDeveloper
© 2007 by Prentice Hall
9.1: The initial sketch of the search form
9-3
Bedrooms
2 3 4 5 or more
Bathrooms
1 1.5 2 2.5 3 4 or more
Sq Feet
1000 2000 3000 4000 or more
Age/Built
1900 1970 1980 1990 2000 or later
Price
Min:
Sale Status
For sale Pending Sold
Matches
Max:
© 2007 by Prentice Hall
9.2: The structure of Oracle forms
Database Server
Block1 (Query)
Item1
Item2
Item3
Block2 (Query)
Item1
Item2
Item3
9-4
Canvas
Items
Frame
© 2007 by Prentice Hall
9.3: Initial canvas, data block, and items for search form
Creating a canvas and simple data block
9-5
© 2007 by Prentice Hall
9.4 Query Data Source Columns data entry
9-6
© 2007 by Prentice Hall
9.5 The intermediate search form
9-7
© 2007 by Prentice Hall
9.6 Search form results
9-8
© 2007 by Prentice Hall
9.7 Sequence of primary trigger events
Form
Block
Item
1. Pre-Logon
2. On-Logon
3. Post-Logon
4. Pre-Form
5. When-Create-Record
6. Pre-Block
Enter
7. Pre-Record
8. Pre-Text-Item
9. When-New-Form-Instance
10. When-New-Block-Instance
11. When-New-Record-Instance
12. When-New-Item-Instance
1. Post-Text-Item
2. Post-Record
3. Post-Block
Exit
4. Post-Form
5. On-Rollback
6. Pre-Logout
7. On-Logout
8. Post-Logout
9-9
© 2007 by Prentice Hall
9.8 First firing of the Post-Item trigger
Defining form events
9-10
© 2007 by Prentice Hall
9.9 Common PL/SQL commands
Creating and editing triggers
Create variables
Calculations
Retrieve data
Evaluate conditions
Repeat loop
Catch errors
9-11
DECLARE
tax NUMBER(9,2); price NUMBER(9,2);
AvgSalary NUMBER(10,3);
tax_rate CONSTANT NUMBER := 0.07;
BEGIN
tax := price * tax_rate;
SELECT Avg(Salary) INTO AvgSalary FROM Employee;
IF (condition)
--statements
ELSE
--statements
END IF;
WHILE (j < 10)
LOOP
j := j + 1;
END LOOP;
EXCEPTION
WHEN (error event) THEN …
END;
© 2007 by Prentice Hall
9.10 Some of the standard functions for Oracle forms
9-12
© 2007 by Prentice Hall
9.11 Help descriptions for standard functions
9-13
© 2007 by Prentice Hall
9.12 Some options in the forms debug console
Start debug
Step through code
Break point
Current line
Variables in the trigger
9-14
Form values
© 2007 by Prentice Hall
9.13 Message generated by the division error
Error message
9-15
© 2007 by Prentice Hall
9.14 Trapping a database error generated on the form
Add a letter to the ID
Try to save the changes
Record the
codes from the
error message
9-16
© 2007 by Prentice Hall
9.15 Automatically generated AgentID
Creating sequences
9-17
© 2007 by Prentice Hall
9.16 Basic validation properties
Validating form input
Validation options
9-18
© 2007 by Prentice Hall
9.17 Validation error message
Try to set a recent year
Person is too young
9-19
© 2007 by Prentice Hall
Table 9.1: Properties for the text box in the sub-form to count
Property
Value
Name
MatchCount
Enable
No
Keyboard Navigable No
9-20
Data Type
Number
Calculation Mode
Summary
Summary Function
Count
Summarized Block
LISTINGRESULTS
Summarized Item
LISTINGID
Database Item
No
Visible
No
Width
5
Height
1
Prompt
Count
© 2007 by Prentice Hall
Table 9.2: Properties for the text box to display total
9-21
Property
Value
Name
MatchCount
Enabled
No
Justification
Right
Data Type
Number
Format Mask
9,990
Calculation Mode
Formula
Formula
:LISTINGRESULTS.MatchCount
Database Item
No
Prompt
Number of Matches
© 2007 by Prentice Hall
9.18 Sample search results with count of matches
9-22
© 2007 by Prentice Hall
9.19 Form design with second canvas
Using multiple canvases
9-23
© 2007 by Prentice Hall
9.20 Adding a stacked canvas
Stacked canvas button
Draw the viewport
9-24
© 2007 by Prentice Hall
9.21 Displaying the stacked canvas
9-25
© 2007 by Prentice Hall
9.22 Specifying the canvas and page for data items
Assign the canvas and the page
9-26
© 2007 by Prentice Hall
9.23 Tab canvas with links to Property and Owner data
9-27
© 2007 by Prentice Hall
9.24 Creating a new Data Connection in JDeveloper
Creating Web forms with JDeveloper
Right-click
Click
9-28
© 2007 by Prentice Hall
9.25 Choosing data tables
9-29
© 2007 by Prentice Hall
9.26 Selecting attributes from the Properties entity
9-30
© 2007 by Prentice Hall
9.27 Design of the initial form
Style
HTML Items
9-31
Data Items
© 2007 by Prentice Hall
9.28 Initial form
9-32
© 2007 by Prentice Hall
9.29 The Struts Page Flow Diagram
Adding a search form
9-33
© 2007 by Prentice Hall
9.30 The search form
9-34
© 2007 by Prentice Hall
9.31 The page flow
9-35
© 2007 by Prentice Hall
9.32 The final form
9-36
© 2007 by Prentice Hall