+ All Categories
Home > Documents > Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

Date post: 15-Jan-2016
Category:
View: 225 times
Download: 0 times
Share this document with a friend
Popular Tags:
12
Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV
Transcript
Page 1: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

Chapter 5B-C: Introduction to Forms Builder:

Tiggers, LOV

Page 2: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

2

Lesson B Objectives

After completing this lesson, you should be able to:• Create a data block form that is based on a

database view [Same as using single table]• Create a master-detail form that contains multiple

data blocks [Done in Oracle Lab 7]• Format form text items using format masks

Page 3: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

3

Using Format Masks to Format Character Strings

• Format mask – Same as format model– Set using Property Palette– Proceeded by FM

• Example of format mask for phone number:FM “(”999“)”999“-”9999

• To set the format mask– Open the form in the Layout Editor– Select the text item you want to apply the format to– Right-click and select Property Palette– In the Data property node, type the mask in the Format Mask

text box

999.99 :for numeric fieldsMM/DD/YYYY : for dates

Page 4: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

4

Page 5: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

5

Lesson C Objectives

After completing this lesson, you should be able to:• Use sequences to automatically generate primary

key values in a form• Create lists of values (LOVs) to provide lists for

foreign key values• Describe the different form items that you can use

to enter and modify data values

Page 6: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

6

Using Sequences to Generate Primary Key Values

• Users may make mistakes entering primary key values

• Use sequence to generate key– Create sequence in database– Create a trigger (PL/SQL program)

• that you link to the text item object representing the primary key value on a form

• that inserts the primary key value from the sequence when a user takes action to create a new record

Page 7: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

7

Creating Form Triggers

• Form trigger – Program unit in form that runs in response to event

– Associated with form object

• Event

– User action like clicking a button

– System action like loading or exiting a form

• Trigger firing means …– The trigger runs.

Page 8: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

8

Creating Form Triggers• Built-in events that can be associated with form triggers

• The triggers to be written in PL/SQL editor will fire when event occurs

Triggers dialog box showing block events that can be associated

with triggers

Page 9: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

9

Creating Form Triggers (continued)

• Implicit cursor can be used to retrieve the next sequence value into a form’s text item

• General syntaxSELECT field_name

INTO variable_name

FROM table_name

WHERE search condition;

• Syntax for retrieving next sequence value into the form’s loc_id text item

SELECT loc_id_sequence.NEXTVALINTO :location.loc_idFROM dual;

• loc_id_sequence must be created in the database

• : must be added to refence a form’s text item in PL/SQL

Page 10: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

10

Create a trigger for inserting loc_id when a new record is to be created using

location.fmb

Show how (p. 354-360)

Page 11: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

11

Creating a List of Values (LOV)

• List of values (LOV)– Pronounced ell-oh-vee

– Displays list of possible data values for text item

• LOV display – Dialog box displays possible choices for form

text item

• Record group– Form object that represents data in tabular

format

– Provides values for LOV

Page 12: Chapter 5B-C: Introduction to Forms Builder: Tiggers, LOV.

12

Creating a List of Values (LOV)Show how (p. 364-376)

GO_ITEM(‘block_name.item_name);LIST_VALUES;

GO_ITEM(‘student.f_id);LIST_VALUES;


Recommended