oracle forms reports and graphics
TRANSCRIPT
-
8/12/2019 Oracle Forms Reports and Graphics
1/124
-
8/12/2019 Oracle Forms Reports and Graphics
2/124
o ;). Displaying roperties
o ;)7 Saing, >enerating and #unning 9orms
;)7)* Saing a 9orm
;)7)+ Compiling3Building a 9orm
;)7). #unning a 9orm
;)7)7 #unning a 9orm as a ?aa @pplication or @pplet
;)7)7 Auery By =ample
o ;)2 =ercise Creating a Single Block 9orm
) Creating a MasterEDetail 9orm
o )* /he MasterEDetail #elationship
o )+ Steps to Create a MasterEDetail 9orm
)+)* Create the Master Block
)+)+ Create the Detail Block
o ). #elation roperties of a MasterEDetail 9orm
o )7 rogram Units in a MasterEDetail 9orm
o )2 =tending MasterEDetail 9orms
o ); =ercise Creating a Master3Detail 9orm
4)
-
8/12/2019 Oracle Forms Reports and Graphics
3/124
4)+). Create a ne%
-
8/12/2019 Oracle Forms Reports and Graphics
4/124
o *5); Creating a MasterEDetail #eport
*5);)* Specify the MasterEDetail Data Model and raphics and the Chart 0i&ard
o *+)* >raphics and the Chart 0i&ard
o *+)+ =ercise @dding a Chart to a #eport
*. 8racle Schema Builder
o *.)* Creating Ne% Schema 8(:ects
o *.)+ Displaying =isting Schema 8(:ects
o *.). @dding #elationships (et%een /a(les
+. ntroduction
/his tutorial introduces the 8racle Deeloper ;)5 and ;i suite of tools %hich include 8racle
9orms ;)5, 8racle #eports ;)5, 8racle >raphics ;)5, 8racle Schema Builder ;)5 and 8racle
rocedure Builder ;)5) /he main o(:ecties are to demonstrate and proide handsEon instructionson creating and modifying data entry and -uery forms in arious configurations, reports and
graphics) In addition, the final section gies some instructions on the use of the Schema Builder)
/his set of 8racle tools !as of @pril, +55*" is no% (undled along %ith 0e(DB and 8racle
?Deeloper in the 8racle Internet Deeloper Suite CD ack)
Caeats lease note that 8racle tends to change things like menu items, prompts and other smallthings (et%een each ma:or !certainly" and often minor release) Depending on the eact release of
Deeloper ; or ;i you hae, you may find some small discrepencies (et%een %hat is sho%n in
this tutorial and %hat you see on your screen)
http://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmasterdetailhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmddatamodelhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmdsavinggeneratinghttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#exercise_masterdetailreporthttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#parameterforms_reportshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#customparamformhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingmenusinoracleformshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#menuhierarchyhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingcusomtmenuhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#graphicschartwizhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#graphicschartwizhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#exaddingcharttoformhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#schemabuilderhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingschemaobjectshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#displayingexistingschemaobjectshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#addingrelationshipsbetweentableshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmasterdetailhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmddatamodelhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#repmdsavinggeneratinghttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#exercise_masterdetailreporthttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#parameterforms_reportshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#customparamformhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingmenusinoracleformshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#menuhierarchyhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingcusomtmenuhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#graphicschartwizhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#graphicschartwizhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#exaddingcharttoformhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#schemabuilderhttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#creatingschemaobjectshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#displayingexistingschemaobjectshttp://cimic.rutgers.edu/~holowcza/oracle/dev2k/6.0/95c1ae47af5ef5bd37c66a02e6f481eb.html#addingrelationshipsbetweentables -
8/12/2019 Oracle Forms Reports and Graphics
5/124
'. -rereuisites
Before follo%ing this tutorial, a student must hae a alid user account in an 8racle serer)
Contact your DB@ or systems administrator to learn the details of ho% 8racle serer is set up inyour organi&ation)
/his tutorial relies on the eistence of a fe% ta(les in the students schema) Use the 8racle
SA#SSN NUMB=#!*+"
M>#S/@#/D@/= D@/=
D/-/&D/&T/a(le
Attri1ute Data T2pe
=SSN NUMB=#!*+"
D==ND=N/$N@M= F@#CH@#!*5"
/-3O4///a(le
Attri1ute Data T2pe
9N@M= F@#CH@#!4"
MINI/ F@#CH@#!+"
-
8/12/2019 Oracle Forms Reports and Graphics
6/124
S=6 F@#CH@#!*"
BD@/= D@/=
#=
-
8/12/2019 Oracle Forms Reports and Graphics
7/124
%ORE*3N EY $no( RE%ERENCE+ ep5r!en $nu!er(/
*N+ERT *NTO DEPARTMENT VAL,E+ $9RE+EARC&9) ') ---44'''') 922MAY1;7,ARTER+9) 1)
-
8/12/2019 Oracle Forms Reports and Graphics
8/124
.) 8racle >raphics E 9or designing graphics such as charts that can (e added to forms or
reports)
@dditional components include*) rocedure Builder E @n integrated deelopment enironment to %rite and de(ug stored
procedures !program units" for use in the 8racle data(ase or in any of the Deelopertools)
+) Auery Builder E @ >UI (ased -uery (uilder tool) Aueries can (e stored in the datadictionary or in a file system for later use and sharing)
.) Schema Builder E @ >UI tool for creating and modifying ta(les, ie%s and constraints)
7) /ranslation Builder E @ tool for creating foreign language ersions of applications %ritten
in Deeloper)
2) ro:ect Builder E @ soft%are deelopment pro:ect management system that manages
source code for all Deeloper components)
;) =CS E /he 8racle erformance =aluation3Collection System E 9or profiling the
eecution and performance of applications deeloped %ith 8racle tools)
) Discoerer E @ data (ro%sing tool that can (e customi&ed for endEusers)
/his tutorial coers the Deeloper 9orms, #eports and >raphics components and gies a (rief
introduction to the Schema Builder and rocedure Builder tools)
In the follo%ing section, the procedures to run 8racle 9orms under MS 0indo%s 123143N/3+555%ill (e gien)
5.+ tarting Developer tools under indo!s "#$"%$&T$'000
@ typical installation of Deeloper creates seeral folders under the Start rograms menu) /he
main folders for the Deeloper programs for 8racle 9orms ;i are found under the menu item
Or5"e %or!s 6i and include the follo%ing items
/o run 8racle 9orms ;i under 0indo%s 123143N/3+555, click on
the +5r B Pror5!s B Or5"e %or!s6i B %or! ui"er
menu item)
/o run 8racle #eports under 0indo%s 123143N/3+555, click onthe +5r B Pror5!s B Or5"e Repors 6i B Repor
ui"ermenu item)
/o run 8racle >raphics under 0indo%s 123143N/3+555, click on the +5r B Pror5!s B
Or5"e %or!s Repors 6i B 3r5phis ui"ermenu item)
-
8/12/2019 Oracle Forms Reports and Graphics
9/124
9or older ersions of 8racle Deeloper the start menu %ould might hae items such as
Dee"oper 2000 R2.1or Dee"oper 2000 R2.0and so on)
Note In your organi&ation, Deeloper may (e installed or configured slightly differently) Inparticular, the programs may (e grouped under different menus) lease contact your DB@ or
systems administrator, or refer to any local documentationto learn ho% to run the Deelopertools)
5.' tarting Developer tools under 7&8
8racle also makes a ersion of Deeloper ;i that runs under UNI6) /his ersion uses 6E0indo%s %ith the Motif 6E0indo%s li(raries as a graphical user interface)
If your ersion of Deeloper is installed under UNI6, use the follo%ing command lines to start
the different tools
Developer Tool 7&8 Command
9orms Deeloper ;)5 for 6E0indo%s Motif f;5desm
>raphics Deeloper ;)5 for 6E0indo%s Motif g;5desm
rocedure Builder ;)5 for 6E0indo%s Motif pl(ild;5m
#eports Deeloper ;)5 for 6E0indo%s Motif r%(ld;5
Under UNI6, it may (e necessary to set certain enironment aria(les such as /J;5$IC8N,UI$IC8N, 98#MS;5$@/H and so on) Upon installation, eample shell scripts to set these
enironment aria(les are installed in the 8racle Home directory)
9. The Oracle Forms Designer ain creen
8nce the appropriate menu item has (een clicked on !for 0indo%s 123143N/3+555", the 8racle
9orms Builder 0elcome Screen %ill appear
http://cisnet.baruch.cuny.edu/holowczak/oracle/http://cisnet.baruch.cuny.edu/holowczak/oracle/ -
8/12/2019 Oracle Forms Reports and Graphics
10/124
9orms ;)5 displays this %elcome screen as a -uick %ay to start %orking and designing forms) 9orthis tutorial, %e %ill %ork directly from the 8(:ect Naigator since this is this most general %ay
to %ork %ith forms)
/o continue to the 8(:ect Naigator from the 0elcome screen, click on the Cancel (utton or
select the KBuild a form ManuallyK option and click 8J) In either case, the 8(:ect Naigator %illappear)
9.+ Oracle Forms O1:ect &avigator
@fter starting up 8racle 9orms, the main screen %ill (e presented)
-
8/12/2019 Oracle Forms Reports and Graphics
11/124
/his screen is called the Object Navigatorand displays all of the form elements, data (locks,menu items, user defined code li(raries, (uilt in procedures and functions, and data(ase o(:ects
!ta(les, ie%s") /he display is in the form of a collapsi(le tree) In general, clicking on a ;%ill
epand the current item to sho% its details) Clicking on a
-
8/12/2019 Oracle Forms Reports and Graphics
12/124
/he VieGmenu toggles the o(:ect naigator display (et%een isual elements and
o%nership elements)
/he N5i5ormenu has items that control the display of the o(:ect naigator including
epanding and collapsing tree (ranches) /he N5i5ormenu can also (e used to create
and delete o(:ects using the Cre5eand De"eemenu options respectiely)
/he Pror5!menu has items that control form compilation, generation and eecution
!#un") /riggers, rocedures and other L Lir5riesE /hese are li(raries of
-
8/12/2019 Oracle Forms Reports and Graphics
13/124
6. D555se OIesE
-
8/12/2019 Oracle Forms Reports and Graphics
14/124
data in those ta(les easier for users) In 8racle 9orms, a form !or data entry form" acts like a
%indo% into the data(ase schema) @n indiidual focuses the attention of the user to one or a fe%
of the ta(les at a time) In addition, a form can gie prompts so the user kno%s %hat kind of inputis epected and ho% data is to (e entered and manipulated)
By default, eery form in 8racle 9orms has the capa(ility to -uery eisting data in a ta(le,modify eisting data and add ne% data !records" to the ta(le) @ form is (uilt up using one or
more data blocksthat correspond to ta(les in the data(ase) 9ields %ithin the data (lockcorrespond to columns in the data(ase ta(le) @ data (lock is similar to a Data0indo% o(:ect in
o%erBuilder) In the follo%ing figure, a typical form is sho%n)
/his form has t%o data (locks, one for the EMPLOYEEta(le, and one for the DEPENDENTta(le)
/hese data (locks are arranged in aMaster/Detailsetup %here a single =mployee record !themaster" is associated %ith one or more Dependents records !the details")
By default, forms also gies a (utton (ar and a menu) /hese can (e used to scroll through the
records in a (lock, naigate (et%een (locks, set up and perform -ueries against the ta(les, insert,
update and delete records, clear the form and eit the form) 9inally, at the (ottom of each form isa status (ar that displays any releant prompts or error messages and an indication of the records
in the current data (lock)
/here are four main types of forms that can (e designed)
-
8/12/2019 Oracle Forms Reports and Graphics
15/124
Single Block
9orm) /his formcontains a
single data
(lock
correspondingto a single
data(ase ta(le)
Single (lock 9orm
%ith lookup field)/his form contains
a single data (lock
corresponding to a
single data(aseta(le %ith the
addition of one or
more fields thatdisplay data from
some other ta(les)
Such data isKlooked upK %hen
the form runs)
Master3Detail
9orm) /his form
contains t%odata (locks that
are arranged ina master3detail
!one to many"
relationship)
Master3Detail
9orm %ith lookup
fields) /his form issimilar to the
Master3Detail (uthas the additional
lookup fields in
the master and3ordetail (locks)
/here are additional ariations such as a Master3Detail3Detail form %ith . (locks and so on)
Ho%eer, the four types illustrated a(oe are the most common ones) In this tutorial, all four
types %ill (e demonstrated)
6. Creating and Running a Form !ith a ingle =loc*
In this section, the (asic steps for creating a (asic data entry and -uery form for a single data(ase
ta(le %ill (e coered)
In general, aData Blockon a form corresponds to a ta(le in the data(ase) /his is called the Base
Tablefor the data (lock) 9or each ta(le displayed on the form, a ne% data (lock %ill (e created)9or this eample, only one data (lock %ill (e created for the EMPLOYEEta(le)
@ (lock appears on a Canvas%hich is contained in a indo!) /here are many options to control
multiple canas ie%s and multiple %indo%s per form) In these eamples, %e concentrate on asimple arrangement using a single canas and a single %indo%)
/here are a num(er of %ays to create a data (lock) 8ne %ay is to manually define the (ase ta(le
and columns, and their positions on the form) 0hile this is possi(le, it can (e ery tedious)
8racle 9orms ;)5 proides t%o %i&ards !programs that guide the deeloper in performing
common tasks" to create data (locks
-
8/12/2019 Oracle Forms Reports and Graphics
16/124
*) /heData Block !i"ardguides the deeloper through the steps of choosing a (ase ta(le
and columns)
+) /he#ayout !i"ardguides the deeloper through arranging the (ase ta(le and columns onthe form)
6.+ Creating a &e! =loc*
/o create a ne% (lock, pull do%n the Too"smenu and select the D55 "o GiJ5rmenu
item) /he follo%ing dialog (o %ill appear
Click on the Net (utton) /he follo%ing dialog (o %ill appear
-
8/12/2019 Oracle Forms Reports and Graphics
17/124
/here are t%o types of data (locks that can (e created) /a(le3Fie% and rocedures) 9or this
eample, choose /a(le3Fie% and click on the Net (utton)
/he net step is to choose a (ase ta(le and columns that %ill (elong to the data (lock) /he
follo%ing dialog (o should appear
-
8/12/2019 Oracle Forms Reports and Graphics
18/124
/o associate a data(ase ta(le %ith the (lock, click on the roGse...(utton to the right of the
/a(le or Fie% field) /he follo%ing dialog (o %ill pop up)
-
8/12/2019 Oracle Forms Reports and Graphics
19/124
Make sure the Curren ,serand T5"es(uttons are selected @ list of your ta(les %ill appear)
Highlight the name of the data(ase ta(le !=M
-
8/12/2019 Oracle Forms Reports and Graphics
20/124
In this eample, %e %ant to continue on to the
-
8/12/2019 Oracle Forms Reports and Graphics
21/124
Click on the Net (utton and the follo%ing dialog (o %ill appear
-
8/12/2019 Oracle Forms Reports and Graphics
22/124
/he layout for a data (lock may (e placed on any eisting canas) In this case, there are no
canases so the only option aaila(le is to create a ne% canas)
Click on the Net (utton to display the follo%ing dialog (o
In this dialog (o, the columns from a gien (ase ta(le on a data (lock can (e added to thelayout) Since %e are laying out the =M
-
8/12/2019 Oracle Forms Reports and Graphics
23/124
-
8/12/2019 Oracle Forms Reports and Graphics
24/124
/here are t%o main styles for forms) @ Ta1ularlayout arranges the field la(els across the top of
the form %ith a num(er of records (elo% as in a spreadsheet)
@ Formlayout places the field la(els to the left of the fields) >enerally only one record isdisplayed at a time)
9or this eample, choose a 9orm layout and click on the Net (utton)
In the follo%ing dialog (o, type a title for the frame !around the data (lock" and check the
option to include a scroll (ar)
/he num(er of records displayed for aFormlayout should (e *) /he num(er of recordsdisplayed in a Tabularlayout can (e more than *)
Click on the Net (utton and the final dialog (o for the
-
8/12/2019 Oracle Forms Reports and Graphics
25/124
Click on the 9inish (utton to create the layout) @ ne% Canas %ill (e created
@t this point the
-
8/12/2019 Oracle Forms Reports and Graphics
26/124
-
8/12/2019 Oracle Forms Reports and Graphics
27/124
/o change the tet color of a la(el, use the pointer tool to highlight a la(el and then
click on the TeF Co"orpalette (utton to choose the color)
Change the %idth of a field (y clicking on the field) /hen drag one of the handles !small
(lack (oes around the field" to reEsi&e the field)
9or eampe, on the employee form, you may %ish to make the S=6 field %ider to
accomodate the capital letter M)
Use the Zoom In tool to &oom in to the form !e)g), make eerything appear larger")
8r use the Zoom 8ut tool to &oom out of the form)
6.5 Displa2ing -roperties
0hile in the
-
8/12/2019 Oracle Forms Reports and Graphics
28/124
=ach type of o(:ect has a slightly different set of properties) 9or eample, dou(le clicking on the
=M
-
8/12/2019 Oracle Forms Reports and Graphics
29/124
-
8/12/2019 Oracle Forms Reports and Graphics
30/124
Under MS 0indo%s 123143N/3+555, forms can (e saed in a folder !su(directory" on the local
hard disk, on a file serer or on a floppy disk) It is desira(le to maintain separate su(directories
!folders" for forms associated %ith different pro:ects)
6.9.+ aving a Form
/o sae a form, pull do%n the %i"emenu and select the +5emenu item)
Under MS 0indo%s 123143N/3+555, this dialog (o looks like
Note that in your company or organi&ation, forms and other files may hae to (e saed on floppydisk or in a special directory) /he a(oe figure is simply an eample)
9ill in a file name in the %i"e N5!e:field) Be sure it ends %ith .8!
Click on the +5e(utton to sae the file) 9or this eample, use the file name e!p"o#ee.8!
/o sae this form on a floppy disk in the A:drie, use the file name A:Ke!p"o#ee.8!
/o enhance porta(ility of forms across different operating systems, use file names that (egin
%ith a letter, contain no spaces or punctuation !ecept for the underscore character", hae all
lo%er case letters and are relatiely short)
If you are %orking on a form and %ish to sae it under a differentfile name, follo% the same
steps as a(oe, only select the +5e Asmenu item in place of the +5emenu item) 9or eample,
if you hae finished %orking on the =mployee form and %ish to sae off a copy (efore addingsome code or programming some program units, the +5e Asmenu item can (e used to sae off
a copy (efore proceeding)
-
8/12/2019 Oracle Forms Reports and Graphics
31/124
-
8/12/2019 Oracle Forms Reports and Graphics
32/124
Use the arious menus and items to -uery the form, enter ne% data and sae ne% and changed
data) lease read the section (elo% on Auery By =ample to see ho% to -uery data from the
underlying ta(les and populate the fields in the form)
6.9.9 Running a Form as a ?ava Application or Applet
If you hae also installed the 9orms Serer !0indo%s N/3+555 only" you may also run the form
in K0e(K mode (y selecting the rogram menu and then K0e(K) In 8racle 9orms ; and ;i, the
.8!Ffile is loaded and eecuted in a ?aa @pplication) In this mode the 9orms serer handles the
processing of the (usiness logic and interacts %ith the user interface elements that run in the ?aa
@pplication)
@n eample of a simple =mployee data entry form running in a ?aa @pplication is sho%n
(elo%
@nother option for running 8racle forms is to run them %ithin a %e( (ro%ser as a ?aa @pplet)
/he (asic steps for this inole setting up a %e( serer !such as 8racle @pplication Serer or8racle 0e(DB" to sere the .8!Ffile and a series of ?aa application class files to the %e(
(ro%ser client) 8racle proides their o%n ?aa runtime enironment !?#=" called the ?EInitiator
that must (e installed on each client) ?EInitiator hooks into the clients %e( (ro%ser using aspecial MIM= data type that launches 8racle ?#= %hen an 8racle form is loaded into the
-
8/12/2019 Oracle Forms Reports and Graphics
33/124
(ro%ser) Belo% is an eample of the same data entry form running as a ?aa @pplet inside of the
Netscape Naigator %e( (ros%er)
9orms ;i proides a simple test %e( page located under the 8racle 9orms ;i program group
called K#un a 9orm on the 0e(K) 8ne can make use of that to test if the 9orms serer, load(alancer, and %e( serer on the middle tier are running correctly)
lease note that getting 8racle 9orms and #eports to run in this fashion is not a triial
undertaking) It re-uires etensie kno%ledge of %e( serers, 0indo%s N/3+555 serices and the
%ay in %hich the forms applications are processed across the three tier architecture)
/he a(oe discussion is meant as a (asic introduction to the ?aa @pplication and @pplet
features of 8racle 9orms) It is (eyond the scope of this tutorial to present the details for
configuring serers and serices to proide this capa(ility) lease refer to the onEline
documentation that comes %ith 98rms ;i for more detailed descriptions and configurationinstructions)
-
8/12/2019 Oracle Forms Reports and Graphics
34/124
6.9.9 >uer2 =2 /@ample
0hen a Deeloper 9orm is first eecuted, no records %ill appear) /hat is, the (lank form %ill
appear %ith no data in the fields) /his is similar to running a %ord processor %here the openingscreen is (lank) 9rom this (lank or empty form, the user can immediately (egin to enter ne% data
records (y simply typing them in)
Ho%eer, in may cases, the user %ould first like to see if there are any records in the data(ase)
/o do this, the user must %uerythe data(ase using the -uery capa(ilities that are (uilt into eery8racle form) /his %ill (ring a copy of the records from the data(ase into the form)
0hen a tool such as SA
-
8/12/2019 Oracle Forms Reports and Graphics
35/124
/he user can naigate through the data in a (lock (y pressing the up and do%n arro% keys to
scroll (et%een records) /o change data in a form, the user can /@B to the field of interest, and
type oer the eisting data)
/o enter ne% data into the form, the user can scroll to the last record and then do%n once more to
moe to a (lank record) Data can then (e typed into the fields and the /@B key can (e pressed tomoe (et%een fields on the form)
/o sae (oth changed and ne% records on a form, pull do%n the Aionmenu and choose the
+5emenu item) @ny records that hae (een changed are collected and su(mitted to the data(ase
as SA< UD@/= statements) @ny ne% records are collected and su(mitted to the data(ase as
INS=#/ statements) /hese statements are su(mitted as a single logical unit of %ork) /hus if afailure occurs during any of the statements, the entire transaction %ill (e rolled (ack)
If the user attempts to clear the (lock or eit the form and there are some changes that hae not
yet (een applied to the data(ase, they %ill (e prompted to commit the changes (efore eiting or
clearing the form) /he (lock is cleared %hen the =nter Auery mode is inoked) @ (lock can also(e cleared using the C"e5r "oand C"e5r %or!menu items)
/o eit from a running form, pull do%n the Aionmenu and select the EFimenu item)
@s a reie%, here are a fe% (asic functions that can (e performed (y default in any 9orm
Forms
function&otes
Auerying aform
/o see all records in the ta(le, simply K=ecute AueryK !ia Auery menu or (y
pressing 94 in 0indo%s")/o filter the record, Kenter -ueryK mode, specify the -uery parameters in the fields
and then K=ecute AueryK)
Inserting ne%
records
Scroll to the last record and then scroll once more to get a (lank record) /ype in
data for each field and then commit these changes (y pulling do%n the Aion
menu and choose the +5emenu item)
9or master3detail forms !discussed (elo%" first either -uery a master record or
insert and sae a master record !in the master data (lock", then naigate to the
detail (lock and insert ne% records there)
Updating
eistingrecords
Auery the data(ase and scroll to the record of interest) Change the alues in the
fields and then sae the changes)
9or master3detail forms, changes to the key in the master (lock may (e preentedif detail records eist !thus insuring relational integrity")
Deleting
records
Auery the data(ase and scroll to the record of interest) ull do%n the #ecords
menu and choose Delete record) /hen sae the changes)
9or master3detail forms, attempting to delete a master record %hen detail recordseist typically results in an error) In such cases, all of the detail records should (e
deleted first and then the master record should (e a(le to (e deleted)
-
8/12/2019 Oracle Forms Reports and Graphics
36/124
6.# /@ercise Creating a a ingle =loc* Form
9or this eercise, create a simple data entry form for the D=@#/M=N/ ta(le %ith the
follo%ing characteristics
Select and display all of the columns in the D=@#/M=N/ ta(le) In the layout %i&ard, use the /a(ularlayout anddisplay 2 #ecordsin the form) @dd a
scroll(ar)
In the
-
8/12/2019 Oracle Forms Reports and Graphics
37/124
B.+ The aster
-
8/12/2019 Oracle Forms Reports and Graphics
38/124
B.'.+ Create the aster =loc*
In the 8(:ect Naigator, click on the %or!s(ranch at the ery top) Create a ne% form (y pulling
do%n the %i"emenu and choosing the NeGmenu item) /hen choose %or!from the flyout menu)
Using the same steps gien in the prior section on Creating a 9orm %ith a Single Block, create ane% (lock named DEPARTMENTthat contains all of the columns in the DEPARTMENTta(le) Briefly
1. ull do%n the Too"smenu and choose the Data Block %i&ard)
+) Create a data (lock for a ta(le3ie%)
.) Specify the D=@#/M=N/ ta(le and select all of the columns !DN@M=, DNUMB=#,
M>#SSN and M>#S@#/D@/=")
7) Create the data (lock and then go on to the
-
8/12/2019 Oracle Forms Reports and Graphics
39/124
1) Specify a frame title of KDepartmentsK and select only * record to (e displayed)
10.Sae the form as epe!p.8!and then compile and run it to make sure it is %orking
properly)
11.Use the AB= features to retriee only those departments %ith DNUMB=# greater than +)
/hen, do another AB= -uery to retriee only those departments %ith the letter &in theirname !try &")
@fter this first step, the epe!pform should look like the follo%ing
B.'.' Create the Detail =loc*
No% that %e hae the master (lock D=@#/M=N/ created, %e can no% create the detail (lock
=M
-
8/12/2019 Oracle Forms Reports and Graphics
40/124
2) Because at least one data (lock already eists in the form, the net step in the %i&ard %ill
(e to create a relationship (et%een the eisting data (lock !D=@#/M=N/ in this case"
and the ne% (lock (eing created)
/he %i&ard can construct the relationship (ased on ta(le leel constraints it learns fromthe data(ase schema) 9or eample, in the C#=@/= /@B
-
8/12/2019 Oracle Forms Reports and Graphics
41/124
0hen the list of (locks appears, choose the D=@#/M=N/ data (lock)
@rrange the Detail Item !DNO" and Master Item !DN,MER" such as that the :oin condition
(ecomes EMPLOYEE.DNO DEPARTMENT.DN,MER
;) Create the data (lock and then call the
-
8/12/2019 Oracle Forms Reports and Graphics
42/124
Notice that (y scrolling the master (lock D=@#/M=N/ to a ne% department num(er !usingthe up and do%n arro% keys", the employees for that department are automatically -ueried and
displayed)
/o naigate (et%een the Master and Detail (locks, use
/o go to the net (lock ress CTRLP5eDoGnor pull do%n the "omenu and chooseNeF
/o go to the preious (lock ress CTRLP5e,por pull do%n the "omenu and
choose Preious
B.5 Relation -roperties of a aster
-
8/12/2019 Oracle Forms Reports and Graphics
43/124
/o ie% the properties for the D=@#/M=N/$=M
-
8/12/2019 Oracle Forms Reports and Graphics
44/124
&ameE /he name of the #elation) /his is typically made up of the names of the (locks)
Relation T2peE /he type of the relation ?oin or #ef)
@ ?oin relation uses the typical SA< :oin !in the 0here clause" to (ring the t%o ta(les
!data (locks" together) /he+efrelation type is used for a(stract data types and o(:ect
references)
Detail Data =loc*E /he name of the detail data (lock specified %hen the detail data
(lock %as created)
?oin ConditionE /his is the :oin condition in effect for -ueries to the data(ase) /his %as
specified %hen the detail data (lock %as created)
Delete Record =ehaviorE Used to specify ho% the deletion of a record in the master
(lock affects records in the detail (lock) It supports the follo%ing settings
o NonEisolated reents the deletion of a master record if associated detail records
eist in the data(ase)
o Isolated Deleting the master record %ill not affect the associated detail records in
the data(ase)
o Cascading Deletes the master record and automatically deletes any associated
detail records)
Coordination < DeferredE Indicates %hen detail records should (e -ueried %hen a
master record is -ueried)
-
8/12/2019 Oracle Forms Reports and Graphics
45/124
o Yes 9orm does not -uery the detail records until the user naigates to the detail
(lock)
o No Detail records are fetched immediately %hen a user -ueries the master record)
Deferred is sometimes set to Yes in cases %here there are a lot of detail records for each
master record) In such cases, a lot of data must (e -ueried and deliered to the client eachtime a ne% record is displayed in the master (lock) 0hen Deferred is set to Yes, the user
can scroll do%n to the master record of interest and then naigate to the detail (lock
!C/#
-
8/12/2019 Oracle Forms Reports and Graphics
46/124
-
8/12/2019 Oracle Forms Reports and Graphics
47/124
-
8/12/2019 Oracle Forms Reports and Graphics
48/124
MasterEDetail forms can (e etended to include additional leels of details) 9or eample,
consider a Customer listing %ith detail on 8rders a customer has placed) 9or each 8rder, there
are then many Items) @n etension to the a(oe eample %ould (e to include theD==ND=N/S of the employees as a details of the =M
-
8/12/2019 Oracle Forms Reports and Graphics
49/124
Auery the master (lock and practice naigating (et%een the t%o (locks using the C/#
-
8/12/2019 Oracle Forms Reports and Graphics
50/124
8ne solution to this pro(lem is to make a list of appropriate alues aaila(le %hen the user
naigates to Department Num(er field !DN8") In 8racle 9orms, these are called
-
8/12/2019 Oracle Forms Reports and Graphics
51/124
/he default is set to create a ne% #ecord >roup) Make sure this selection is highlighted and then
click the Net (utton)
In most cases, you %ill not hae a record group created preiously) Ho%eer, one can (e createdon the fly at this point (y specifying a -uery) In this eample, enter the
-
8/12/2019 Oracle Forms Reports and Graphics
52/124
/hen click on the Net (utton)
/he net step is to specify %hich columns in the record group %ill (e returned to for use (y the
-
8/12/2019 Oracle Forms Reports and Graphics
53/124
-
8/12/2019 Oracle Forms Reports and Graphics
54/124
/o map the
-
8/12/2019 Oracle Forms Reports and Graphics
55/124
/he adanced properties relate to ho% the records should (e fetched for the
-
8/12/2019 Oracle Forms Reports and Graphics
56/124
In this final step, the
-
8/12/2019 Oracle Forms Reports and Graphics
57/124
In the figure (elo%, the
-
8/12/2019 Oracle Forms Reports and Graphics
58/124
Sae, Compile and #un the form) 0hen entering ne% data, naigate to the DN8 !Department
num(er" field) Notice at the (ottom of the form, a message appears Lis o8 V5"uesindicating
a list of alues is aaila(le for this field)
Under UNI6, the key to display the list of alues is ControlEl)
Under MS 0indo%s 123143N/3+555 the key to display the list of alues is 91)
/o see the appropriate keys to press, pull do%n the &e"pmenu and choose the e#sitem)
-
8/12/2019 Oracle Forms Reports and Graphics
59/124
%.' &on
-
8/12/2019 Oracle Forms Reports and Graphics
60/124
Click on the /et Item tool and create a ne% field on the =Muer2 Onl2No
-rimar2 e2No
nsert Allo!edNo
>uer2 Allo!edNo
7pdate Allo!edNo
By setting Jey(oard Naiga(le toNo, %e
preent the user from ta((ing into this field)
Since this field is not used for data entry or-uerying, this preents the potential
confusion)
-
8/12/2019 Oracle Forms Reports and Graphics
61/124
/he Data(ase Item property is set toNo%hich indicates that this filed does not map to an
actual column in the =M
-
8/12/2019 Oracle Forms Reports and Graphics
62/124
0hen the
-
8/12/2019 Oracle Forms Reports and Graphics
63/124
Close the
-
8/12/2019 Oracle Forms Reports and Graphics
64/124
9or this eercise, create a ne%, single data (lock form (ased on all of the columns in the
D=@#/M=N/ ta(le) /hen add a nonE(ase ta(le field for the last name of the department
manager and create an = trigger on the M>#SSN item so that %hen it changes, thefollo%ing code %ill eecute
+ELECT "n5!e
*NTO :DEPARTMENT.M3RLA+TNAME
%ROM e!p"o#ee
?&ERE e!p"o#ee.ssn :DEPARTMENT.M3R++N/
/his %ill automatically populate the non (ase ta(le field M>#$
-
8/12/2019 Oracle Forms Reports and Graphics
65/124
". Oracle Forms -rogram 7nits and tored -rogram 7nits
8racle 9orms proides a mechanism to store procedures !called rogram Units" %ritten in the
-
8/12/2019 Oracle Forms Reports and Graphics
66/124
".+ Creating -rogram 7nits in Oracle Forms
In this section, %e %ill augment the =M
-
8/12/2019 Oracle Forms Reports and Graphics
67/124
".+.' Create a -rocedure to Count Other Department em1ers
In this step, create a rogram Unit !procedure" in 8racle 9orms to count the num(er of othermem(ers in the same department) 9or this procedure, %e %ill pass in a parameter called
IN$=M
-
8/12/2019 Oracle Forms Reports and Graphics
68/124
TEMPCO,NT : 0/ *nii5"iJe o 0
Tr# 5n 8i"" TEMPCO,NT Gih he oun o8 oher E!p"o#ees in he ep5r!en
+ELECT CO,NT$( *NTO TEMPCO,NT
%ROM EMPLOYEE ?&ERE EMPLOYEE.DNO $+ELECT EMPLOYEE.DNO
%ROM EMPLOYEE ?&ERE EMPLOYEE.++N *NEMPLOYEE++N(/
+ee i8 Ge o 5 !e5nin8u" resu" *% $NVL$TEMPCO,NT) 0( QB 0( T&EN O,TCO,NTOT&ERMEMER+ : $TEMPCO,NT 1 (/ EL+E
O,TCO,NTOT&ERMEMER+ : 0/ END *%/END/
/he procedure is %ritten in three main sections) @ny lines starting %ith are comments and are
ignored (y 8racle forms)
/he heading for the procedure definition indicates that one parameter, IN$=MIN statement starts the (ody of the procedure) /=M$C8UN/ is initiali&ed to 5 and
then a -uery is performed on the data(ase to find the total num(er of employees in the samedepartment as the employee %hose SSN %as supplied to the procedure)
/he result in /=M$C8UN/ is checked to see if it is a NU
-
8/12/2019 Oracle Forms Reports and Graphics
69/124
-
8/12/2019 Oracle Forms Reports and Graphics
70/124
".' Creating tored -rocedures in >3H-lus
In the preious eample, %e added a procedure !rogram Unit" in 8racle 9orms to perform a
-uery on the data(ase) /he procedure is stored as part of the forms source code and is compiled
%hen the form is (uilt) Upon eamination, each call of this procedure produces*) @ local call from the 8S/ECH@N>= trigger to the procedure passing an employees
SSN)
+) @ remote access from the procedure to the data(ase passing a SA< -uery)
.) @ remote return from the data(ase containing a count)
7) @ small amount of processing in the procedure !I9 ))) /H=N")
2) @ local return from the procedure to the trigger)
In this echange, the highest costs are incurred (y the net%ork traffic re-uired to go (ack andforth (et%een client and serer !steps + and .") /he lo%est costs are incurred (y the local calls
(et%een trigger and procedure and the local processing !steps *, 7 and 2")
In this eample, the SA< Auery in steps + and . does not return a significant amount of data)
Ho%eer, there are situations %here, if a large amount of data %ere to (e returned for each -uery,such -ueries %ould seerely impact performance)
8ne solution to this pro(lem is to moe the -ueries and as much processing as possi(le KcloserK
to the data in the data(ase) /hus our eample for this section %ill (e to implement the
8/H=#$D=@#/M=N/$M=MB=#S procedure in the 8racle data(ase) /o achiee this, %e%ill need to use 8racle SA
-
8/12/2019 Oracle Forms Reports and Graphics
71/124
-
8/12/2019 Oracle Forms Reports and Graphics
72/124
In some ersions of SALB CREATE PROCED,RE es A+ 2 E3*N
- +ELECT +Y+DATE *NTO :e!p %ROM u5"/ 4 END/ ' H
?5rnin: Proeure re5e Gih o!pi"5ion errors.
+>LB shoG errorsu88er oer8"oG. ,se +ET o!!5n o reue ARRAY+*@E or inre5se MADATA.No errors.
If the u88er oer8"oGmessage appears, set the @##@YSIZ= aria(le to a lo%er num(er suchas + %ith the follo%ing command
+>LB +ET ARRAY+*@E 2
/hen use the shoG errorscommand as descri(ed
+>LB shoG errorsErrors 8or PROCED,RE TE+T:
L*NEHCOL ERROR
-H2- PL+0004;: 5 in 5ri5"e 9TEMP9
/o see %hat stored procedures you hae created, -uery the US=#$S8U#C= ie% in the datadictionary)
/he only ma:or difference (et%een the stored procedure created in the data(ase schema through
SA
-
8/12/2019 Oracle Forms Reports and Graphics
73/124
8nce the 8/H=#$D=@#/M=N/$M=MB=#S procedure !rogram Unit" has (een created in
SA= trigger on =M
-
8/12/2019 Oracle Forms Reports and Graphics
74/124
8ne solution to this pro(lem is to use an 8racle Se-uence) @n 8racle Se-uence is a schema
o(:ect that keeps track of a simple integer and automatically increments this counter %hen it is
accessed)
9or eample, in our D=@#/M=N/ ta(le, the DNUMB=# is an integer that should increase for
each ne% department) /o automatically generate a ne% DNUMB=#, create an 8racle Se-uenceusing the SA,ENCE ep5r!ense *NCREMENT Y 1 +TART ?*T& 1 MAVAL,E ;;;;; NOCYCLE/
/he a(oe ep5r!ensese-uence %ill (egin counting from * and increment (y * until it
reaches 11111) @fter that, accessing the se-uence %ill produce an error) /his is reasona(le since
it is highly unlikely an organi&ation %ill eer hae more than 11111 departments)
/he net step is to assign the net alue of the se-uence to the DNUMB=# item in theD=@#/M=N/ data (lock) @ trigger to do this %ould (e created at the (lock leel and should
eecute (efore any ne% record is inserted into the data(ase) @ PRE*N+ERTtrigger on the
D=@#/M=N/ data (lock %ould (e used for this eample
E3*N 3e he neF 5"ue 8or DN,MER 8ro! he ep5r!ense seuene. +ELECT ep5r!ense.neF5" *NTO :ep5r!en.nu!er %ROM u5"/ END/
/he u5"ta(le is a dummy ta(le that contains eactly one record !ro%") 0e can use it in a
S=
-
8/12/2019 Oracle Forms Reports and Graphics
75/124
ho%eer, the enforcement only takes place %hen a transaction reaches the data(ase) In addition,
many constraints on the data that inole alues of data from other ta(les may not (e easily
implemented as ta(le constraints)
Many types of constraints on data can (e checked in the client using triggers) 9or eample, in our
=M=#$9@I
-
8/12/2019 Oracle Forms Reports and Graphics
76/124
*% $:+,PER++N :++N( T&EN
reurn5"er : +&O?ALERT $9+,PERV*+ORALERT9(/
RA*+E %ORMTR*33ER%A*L,RE/
END *%/
END/
/he SH80$@
-
8/12/2019 Oracle Forms Reports and Graphics
77/124
E3*N *% :+,PER++N *+ N,LL T&EN +ELECT ep5r!en.!rssn *NTO :e!p"o#ee.superssn %ROM ep5r!en ?&ERE ep5r!en.nu!er :e!p"o#ee.no/ END *%/ END/
Note that the I9 statement uses :+,PER++N *+ N,LLto check to see if any alue has (een
supplied for SU=#SSN) If nothing %as typed into the SU=#SSN data item, then its alue is
NU
-
8/12/2019 Oracle Forms Reports and Graphics
78/124
9or this eample, %e %il make use of t%o forms @ (asic =M
-
8/12/2019 Oracle Forms Reports and Graphics
79/124
H O5in he "o *D o8 he EMPLOYEE "o. This is he H
H M5ser "o in he e!pepn !5serHe5i" 8or!. H
"i : %in"o$9EMPLOYEE9(/
*% NOT *Nu""$"i( T&EN
H Che o !5e sure our p5r5!eer h5s 5 5"ue. *8 his 8or! H
H Gere eFeue # ise"8) hen he p5r5!eer Gi"" e nu"". H
H *8 his 8or! is 5""e 8ro! EMPLOYEE hen he p5r5!eer Gi"" H
H e p5sse 5"on 5n 5ssine o :PARAMETER.e!p"o#eessn H
*% $:PARAMETER.e!p"o#eessn is no nu""( T&EN
H +ine Ge h5e 5 p5r5!eer) use i o 5"er he ?&ERE C"5use H
H proper# so h5 i eo!es ?&ERE ssn:PARAMETER.e!p"o#eessnH
+ETLOCPROPERTY$"i)DE%A,LT?&ERE)9ssn9 SS:PARAMETER.e!p"o#eessn(/
H N5i5e o he EMPLOYEE "o 5n eFeue 5 uer#5uo!5i5""# H
3OLOC$9EMPLOYEE9(/
EEC,TE>,ERY/
END *%/
END *%/
END/
Compile and sae the e!pepnform)
No% run the =M
-
8/12/2019 Oracle Forms Reports and Graphics
80/124
@fter you learn ho% to create #eports !see the net section" create a simple
D=@#/M=N/ data entry form %ith a (utton that, %hen pressed, %ill run a report for
that department (y passing along the DNUMB=# as a parameter)
+0. Oracle Reports =asics
0e no% turn our attention to another Deeloper tool called 8racle #eports) /he 8racle #eports
Builder allo%s the deeloper to create sophisticated reports in a ariety of layouts and contains
many customi&ation features) In this section, the (asic steps for creating a simple report and aMasterEDetail report %ill (e gien)
+0.+ tarting Developer tools under indo!s "#$"%$&T$'000
@ typical installation of Deeloper creates seeral folders under the Start rograms menu) /he
main items for the 8racle #eports ;i programs are found under the menu item Or5"e Repors
6iand include the follo%ing items
/o run 8racle #eports Builder under 0indo%s 123143N/3+555, click on the +5r B
Pror5!s B Or5"e Repors 6i B Repor ui"ermenu item)
@s %ith 8racle 9orms, an initial screen %ill appear
-
8/12/2019 Oracle Forms Reports and Graphics
81/124
-
8/12/2019 Oracle Forms Reports and Graphics
82/124
/he main sections of the 8(:ect Naigator are
*) Data odelE Contains information a(out -ueries used for a report)
+)3a2out
E Contains information a(out ho% a report is formatted including headers,
footers, margins, fonts, etc)
.) -arameter FormE Contains information a(out the initial screen that is displayed %hen a
form first runs)
7) Report TriggersE
-
8/12/2019 Oracle Forms Reports and Graphics
83/124
@s %ith 8racle 9orms, the first step in using 8racle #eports is to Connect to an 8racle serer)
/his is accomplished (y pulling do%n the %i"emenu and selecting the Connemenu item)
9ill in your 8racle Username and 8racle ass%ord !press the ta( key to moe (et%een thefields")
9or the D555sefield, type in the serice name for your 8racle data(ase) 9or eample, if you
are using ersonal 8racle
-
8/12/2019 Oracle Forms Reports and Graphics
84/124
In this section, %e go through the steps for creating a report that ie%s the contents of a single
ta(le)
+0.9.+ pecif2 the Data odel and 3a2out
/he first step is to specify the data model and layout of the report) 0e %ill use the #eport %i&ardto accomplish this) 9rom the 8(:ect Naigator, pull do%n the Too"smenu and choose ReporGiJ5r...
/he first screen for the reports %i&ard %ill appear prompting for the style of the report and for
the #eport /itle)
/he eight layout choices include
*) /a(ular E Simple ta(le %ith column headings at the top and data records in consecutie
ro%s (elo%)+) 9ormE
-
8/12/2019 Oracle Forms Reports and Graphics
85/124
2) >roupEroupE@(oe E @ Master3Detail3Detail style %here the master records appear a(oe the
detail records)
) Matri E Column la(els on (oth the left and the top %ith data alues in the middle)Similar to a spreadsheet)
4) Matri %ith >roup E @ com(ination of Master3Detail !>roupE@(oe" and Matri)
9or this report, type in K=mployee #eportK as the title, choose the Ta1ular
-
8/12/2019 Oracle Forms Reports and Graphics
86/124
/hen click on the Net (utton to moe to the net step) Note If you did not Connect to the
data(ase, you %ill (e prompted for the Username, ass%ord and Data(ase)
In the net %i&ard dialog (o, specify %hich columns from the SA< Auery %ill (e displayed inthe report output) /o specify all columns, click on the dou(le right arro% to (ring all of the
vailable Fieldsto theDis$layed Fieldsside)
Click on the Net (utton to moe to the net dialog (o)
In the net step, aggregate functions can (e applied to the fields on the report) 9or this eample,
%e %ill display the aerage salary as %ell as a count of employees) Highlight the S@
-
8/12/2019 Oracle Forms Reports and Graphics
87/124
/he net dialog (o allo%s you to change the field la(els and display %idths for arious fields inthe report)
-
8/12/2019 Oracle Forms Reports and Graphics
88/124
-
8/12/2019 Oracle Forms Reports and Graphics
89/124
@fter a short delay, the #eports
-
8/12/2019 Oracle Forms Reports and Graphics
90/124
It is possi(le to make changes to the layout of the report (y using the tool palette on the left hand
side) 0hen you hae finished touching up the report, close the #eports
-
8/12/2019 Oracle Forms Reports and Graphics
91/124
9or this eample, sae this report as e!p"o#ee.r8
8nce the report is saed, it can (e run (y pulling do%n the VieGmenu and choosing the Runi!e
PreieGmenu item)
@s the report is running, an @ctiity screen %ill appear giing an indication of the processingthat is currently under%ay)
/he @ctiity %ill go through . stages Client @ctiity %hile the -ueries are prepared, Serer
@ctiity %hen the -ueries are eecuted and finally Client @ctiity as the report is formatted)
0hen this is finished, the report %ill appear on screen)
+0.# /@ercise Creating a Report
9or this eercise, create a report to display all of the records in the D=@#/M=N/ ta(leincluding a :oin %ith the =M
-
8/12/2019 Oracle Forms Reports and Graphics
92/124
+0.6 Creating a aster
-
8/12/2019 Oracle Forms Reports and Graphics
93/124
) Designate the DN@M= field as a .rou$ field!
-
8/12/2019 Oracle Forms Reports and Graphics
94/124
+0.6.' aving, Generating and Running the aster
-
8/12/2019 Oracle Forms Reports and Graphics
95/124
+0.B /@ercise Creating a asterroup @(oe report type and use the follo%ing SA< -uery
+ELECT e!p"o#ee.8n5!e) e!p"o#ee."n5!e)
e!p"o#ee.5e A+ E!p5e)
e!p"o#ee.seF A+ E!p+eF) epenen.epenenn5!e)
epenen.5e A+ Dep5e)
epenen.seF A+ Dep+eF) epenen.re"5ionship
%ROM e!p"o#ee) epenen
?&ERE e!p"o#ee.ssn epenen.essn/
Note the use of column aliases !@S" to differentiate the (date and se columns)
Select the "n5!e) 8n5!e) e!pseF) e!p5efields as the K>roup *K fields) /hese
should all (e from the =M
-
8/12/2019 Oracle Forms Reports and Graphics
96/124
+0.% -arameter forms in Oracle Reports
9or each of the 8racle #eports eamples thus far, all of the records in the respectie ta(les %erereturned as part of the report) Ho%eer, there may (e situations %here only a su(set of the
data(ase records are re-uired) In these cases, %e %ould like to prompt the user to enter some
criteria that can (e used to filter the report) In 8racle #eports, a,arameter Formfulfills thisrole)
arameter forms are simple 8racle forms that prompt the user for some information (efore a
report is eecuted) /his information can (ecome part of the 0H=#= clause in the report -ueryand is used to filter the records returned in the report) arameters in 8racle #eports can either (e
filled in (y the user on a parameter form or can (e filled in automatically (y passing the
parameters in from another 8racle 9orms form !see the eample of parameter passing in the
preious section on 8racle 9orms")
In the follo%ing eample, a simple parameter form is automatically created (y 8racle #eports to
restrict a -uery on the =M
-
8/12/2019 Oracle Forms Reports and Graphics
97/124
+) Use the follo%ing SA< -uery eactly as %ritten) Note the use of the full colon in the
0H=#= clause)
-. +ELECT 4. %ROM e!p"o#ee'. ?&ERE e!p"o#ee.no :DNOPARAMETER/
In the a(oe -uery, DN8$@#@M=/=# is the name of a run time parameter) 0hen thereport is eecuted, the user %ill supply a alue for this parameter thus completing the
0H=#= clause for the -uery)
Clicking on the NeF(utton %ill produce the follo%ing alert
;) Choose all of the columns !fields" for display in the report) Do not choose any fields for
summary information)) 0hen the report %i&ard is finished, the report and parameter form !(ased upon the
parameters gien in the SA< -uery" %ill (e created) @s the lie preie%er is running, the
ne% parameter form %ill (e displayed
9or this eample, choose department 2 !type the num(er 2 in the field" and press the enter
key) Notice that only employees in department 2 are displayed in the lie preie%er)
-
8/12/2019 Oracle Forms Reports and Graphics
98/124
+0.%.+ =uilding a Custom -arameter Form
@t this point, %heneer the report is run, a default parameter form sho%ing the
DN8$@#@M=/=# %ill (e displayed) Ho%eer, it is possi(le to create a custom parameterform as sho%n in the follo%ing steps)
1. S%itch to the 8(:ect Naigator, pull do%n the Too"smenu and choose the P5r5!eer
%or! ui"er) /his is sho%n (elo%
@ num(er of (uiltEin system parameters are displayed and can (e highlighted (y clicking
on them %ith the right mouse (utton) Note that at the (ottom of this list is theDN8$@#@M=/=# and it should already (e selected)
2. 9or this eample, in addition to the DN8$@#@M=/=# also select the D=S/Y=,
D=SN@M= and C8I=S parameters) /hen click the O(utton) @ ne% parameter form
%ill (e automatically created as sho%n (elo%)
-
8/12/2019 Oracle Forms Reports and Graphics
99/124
3. Sae the report as e!pp5r5!.r8) 0hen the form is eecuted !pull do%n the Pror5!
menu and choose Run Repor", the ne% parameter form %ill (e displayed as sho%n
(elo%
-
8/12/2019 Oracle Forms Reports and Graphics
100/124
In the a(oe eample, * copy of the report %ill (e sent to the printer named KH
-
8/12/2019 Oracle Forms Reports and Graphics
101/124
/o eplicitly specify the default menu in 9orms ;i
1. Select the name of the form3module in the
8(:ect Naigator) Click %ith the right mouse
(utton and choose Properiesfrom the popE
up menu)
+) In the enu oduleproperty, typeD=9@U
-
8/12/2019 Oracle Forms Reports and Graphics
102/124
+) enusE Including main menus, indiidual menus, and su(menus
.) enu items
++.' Creating a Custom enu
Designing a custom menu re-uires fie (asic steps*) Creating a menu module
+) Creating menus and menu items
.) @ssigning commands to menu items
7) Saing and generating the menu module
2) @ttaching a menu module to a form
++.'.+ Creating a enu odule
/he first step in designing a custom menu is to create a menu module) /here are seeral %ays to
create a ne% menu module
1. ull do%n the %i"emenu, highlight the NeGmenu item and then select the Menumenu
item)
2. Naigate do%n to the enussu(tree in the 8(:ect Naigator, pull do%n the N5i5or
menu and choose the Cre5emenu item)
@ ne% menu module %ill (e created and a default name %ill (e assigned) Click on this default
menu name and assign it a more meaningful name such as !#!enu)
++.'.' Creating menus and menu items
Creating menus and menu items can (e accomplished using the enu /ditor) /o actiate the
menu editor, first highlight the name of your menu, then pull do%n the Too"smenu and click on
the Menu Eioritem)
-
8/12/2019 Oracle Forms Reports and Graphics
103/124
/he main menu items go across the top of the screen) /o add a ne% menu across the top, click on
the =uild Acrossicon on the tool(ar
Su(Emenus and menu items appear (elo% each one) /o add a ne% su(Emenu or menu item, click
on the =uild Do!nicon on the tool(ar
/o change the name of a menu or menu item, click in the menu o(:ect and oerE%rite the name
that appears there)
Using the icons, create and reEla(el seeral menus and menu items to appear as follo%s
8nce this is completed, the (asic menu structure %ill (e in place) /he net step is to add
functionality to each menu item)
-
8/12/2019 Oracle Forms Reports and Graphics
104/124
++.'.5 Assigning Commands to enu tems
/he default (ehaior for clicking on any menu is for that menus items to (e displayed) /he net
step is to assign commands to each of the menu items so that %hen a user clicks on a menu item,a form, report or SA
-
8/12/2019 Oracle Forms Reports and Graphics
105/124
#epeat the a(oe steps for each menu item)
@ final menu item should (e created to =it the application) Call the menu /@it Application
and enter the follo%ing
-
8/12/2019 Oracle Forms Reports and Graphics
106/124
@ custom menu must (e attached to a form in order to (e displayed) /ypically, a form %ith no
data entry on it is used as the main screen to host the custom menu)
/he follo%ing steps are different depending on the ersion of 9orms (eing used)
For Oracle Forms version 9.# For Oracle Forms version 6i
1. Create a ne% form %ith no (locks or
items on it) ull do%n the %i"emenu,
select NeGand then select %or!)
2. Display the properties for the form and
set the enu oduleproperty to the filename of the menu module !see preious
step") 9or this eample, it should (e!#!enu.!!F
3.Make sure the 7se Fileproperty is set toTrue)
4. Sae the form as file "5n8or!.8!and
generate this form) !Note you should saethe this form in the same drie and
directory as your menus .!!Ffile")
1. Create a ne% form %ith no (locks or
items on it) ull do%n the %i"emenu,
select NeGand then select %or!)
Click on the name of the form in the
o(:ect naigator and rename it as
"5n8or!)
2. 8pen up the property palette for the
form and set the follo%ing properties
enu ource 9ile E /he menu
information %ill come from a file)enu odule !#!enu.!!FE /he file
name of the compiled menu module)
You may hae to gie the eplicit path
to this .!!Ffile) 9or eample, if this file
is on your @ drie then type5:K!#!enu.!!F
-
8/12/2019 Oracle Forms Reports and Graphics
107/124
2) #un the form)
3. Sae the form as file "5n8or!.8!
and generate this form) !Note you shouldsae the this form in the same drie and
directory as your menus .!!Ffile")
7) #un the form)
Notice that %hen running this (lank form, the default menu is replaced (y the !#!enuMenu
Module)
-
8/12/2019 Oracle Forms Reports and Graphics
108/124
/he (lank form that is used to host the menu need not (e (lank) You may %ish to use the raphics o(:ect %ill (e added to a (asic Master3Detail form)
@s a first step, create a ne% Master3Detail form using the D=@#/M=N/ ta(le !DNUMB=#and DN@M= columns" as the master (lock and the =M
-
8/12/2019 Oracle Forms Reports and Graphics
109/124
Be sure to sae this form on disk (efore moing on to create the chart)
/o start the Chart 0i&ard, click on any open area of the form %hile in the layout ie%) /hen pull
do%n the Too"smenu and choose the Ch5r ?iJ5r) /he first screen of the Chart 0i&ard %ill
appear as (elo%
-
8/12/2019 Oracle Forms Reports and Graphics
110/124
Click the NeF(utton to moe to the net step in the %i&ard) In the net step, choose the type of
chart !and su(type if applica(le" to (e created) 9or this eample, choose Pieand Dephas sho%n
(elo% and click on the NeF(utton
/he net step is to choose %hich data (lock the chart should (e (ased on) @ll of the data (lockson the current form should (e displayed) 9or this eample, choose the =M
-
8/12/2019 Oracle Forms Reports and Graphics
111/124
/he net step is to choose %hich field in the data (lock should (e used for the 6E@is !or
category la(els" for the chart) 9or this eample, choose the
-
8/12/2019 Oracle Forms Reports and Graphics
112/124
In the last step for the %i&ard, the ne% 8racle >raphics o(:ect must (e saed in a file) >ie a
ne% name for the graphics o(:ect such as e!p"o#ee.oas sho%n (elo% and click on the
%inish(utton
@t this point, the graphics o(:ect %ill (e created and placed on the form) Use the mouse to moe
and reEsi&e the o(:ect as desired) 0hen finished, sae the form again and run it) /he follo%ingfigure sho%s the form as it is running) Notice that %hen the form is -ueried and as ne%
department records are retrieed, the employees and their associated salaries for that department
are displayed in the pie chart)
-
8/12/2019 Oracle Forms Reports and Graphics
113/124
0hen copying forms files that use 8racle >raphics, (e sure to also copy the associated graphicso(:ect files) /hese files typically hae an .O3Dfile etension)
+'.' /@ercise Adding a Chart to a Report
9or this eercise, add a (ar chart depicting the employees salaries to a report sho%ing additional
=mployee data)
Start (y creating a (asic ta(ular #eport making use of the follo%ing -uery
+ELECT %NAME) LNAME) DNO) +ALARY
%ROM EMPLOYEE
/he (asic report is sho%n (elo%
-
8/12/2019 Oracle Forms Reports and Graphics
114/124
Net, add the Chart using the Chart %i&ard) Specify KSalariesK as the chart title, and use a Bar
chart style %ith KDepthK as the su(Etype)
9or the 6 @is, choose
-
8/12/2019 Oracle Forms Reports and Graphics
115/124
+5. Oracle chema =uilder
/he 8racle Schema Builder proides an easy to use graphical user interface for defining and
modifying ta(les, ie%s and other schema o(:ects)
-
8/12/2019 Oracle Forms Reports and Graphics
116/124
/o run the Schema Builder, choose it from the 8racle menu) @s %ith most 8racle deelopment
tools, the first step %ill (e to connect to the data(ase) /he Connect dialog (o %ill appear as
(elo%
roide a alid username, pass%ord and connect string !Host string" and click on the Conne
(utton to esta(lish a connection to the data(ase)
/he main Schema Builder screen %ill appear
+5.+ Creating &e! chema O1:ects
-
8/12/2019 Oracle Forms Reports and Graphics
117/124
Creating a ne% ta(le is a straight for%ard process) 9irst, pull do%n the +he!5menu and choose
the Cre5e T5"emenu item) @ small menu %ill appear) Choose T5"e) /he mouse pointer %ill
change to an arro% %ith a sign) Click in the open space of the Schema Builder main screen and
the ne% ta(le %ill (e created)
Note that the ne% ta(le is gien a default name !TALE1" and it contains seeral eamples
columns)
/o change the name of the ta(le, click on the current name and type oer it %ith a ne% name) Do
not use spaces in the ta(le name) 0hen finished, press =nter or #eturn to set the ne% name for
the ta(le)
/o change the name of a column, click on a column name and type oer the eisting name)
/o add more columns to the ta(le, simply click the lo%er right hand corner of the ta(le displayand drag it do%n%ards) @dditional columns %ill appear %ith their default names)
/o change the data type and other characteristics of columns, dou(le click on the column name)
/he Define Column dialog (o %ill appear) Highlight the column you %ish to modify andchange its datatype and other options on the right hand side) In the figure (elo%, the N@M=
column has (een changed to F@#CH@#!+5" and a N8/ NU
-
8/12/2019 Oracle Forms Reports and Graphics
118/124
In the follo%ing figure, the CUS/8M=#ID column has (een designated as the key (y checking
off the Pri!5r# e#and ,niuecheck (oes)
In the follo%ing figure, each of the columns in the CUS/8M=# ta(le hae (een defined
-
8/12/2019 Oracle Forms Reports and Graphics
119/124
8nce each of the columns has (een renamed and defined, the ta(le must (e saed in the
data(ase) /o see the SA< statements that %ill (e sent to the data(ase serer, pull do%n the
+he!5menu and choose the +hoG +>Lmenu item)
-
8/12/2019 Oracle Forms Reports and Graphics
120/124
@t this point, the SA< statements that %ill (e used to create the schema can (e saed into a tet
file for future use) /o sae the SA< statements, pull do%n the %i"emenu and choose +5e +>L)
@ standard %indo%s file sae dialog (o %ill appear) /he default file etension for SA< files is.s"
/o commit the schema in the data(ase, either click on the Co!!i(utton in the +hoG +>Ldialog(o or, from the main Schema Builder screen, pull do%n the +he!5menu and choose the
Co!!i +he!5menu item) @ dialog (o %ill appear sho%ing the progress)
/o reie%, a typical Schema Builder session %ould consist of adding ne% ta(les to a schema
using the Cre5e T5"emenu item on the +he!5 !enu) Columns in ta(les can (e defined (y
dou(le clicking on the ta(le icons) 8nce all of the ta(les hae (een defined in the SchemaBuilder main screen, sae off the SA< to a file and then commit the schema in the data(ase)
+5.' Displa2ing /@isting chema O1:ects
If the schema has some ta(les or ie%s already defined, these can (e displayed (y pulling do%nthe D55menu and choosing the +e"e D55 T5"esmenu item) @ dialog (o %ill appear
displaying the aaila(le ta(les)
-
8/12/2019 Oracle Forms Reports and Graphics
121/124
/o include a ta(le in the Schema Builder main screen, highlight a ta(le and click on the *n"ue
(utton) /he ta(le should appear on the main screen and the name of the ta(le %ill (e grayed outin the dialog (o)
In this eample, the =M
-
8/12/2019 Oracle Forms Reports and Graphics
122/124
+5.5 Adding Relationships 1et!een Ta1les
8nce the ta(les hae either (een created or displayed in the Schema Builder main screen,
relationships (et%een ta(les can (e defined) In this eample, the DNUMB=# column of the
D=@#/M=N/ ta(le is related to the DN8 columns in the =M
-
8/12/2019 Oracle Forms Reports and Graphics
123/124
-
8/12/2019 Oracle Forms Reports and Graphics
124/124
/he net time (oth D=@#/M=N/ and =M