This document provides an introduction to using Oracle Forms Builder. It describes the major tools in Forms Builder like the IDE, compiler, and runtime engine. It explains how to execute forms in a web-based environment using a web browser, server, and applet. The document outlines how to launch Forms Builder and connect to an Oracle database. It lists the main tools in Forms Builder like the Object Navigator, Property Palette, Layout Editor, and PL/SQL Editor. It provides steps for creating a simple form using the Data Block and Layout Wizards.
This document provides an introduction to using Oracle Forms Builder. It describes the major tools in Forms Builder like the IDE, compiler, and runtime engine. It explains how to execute forms in a web-based environment using a web browser, server, and applet. The document outlines how to launch Forms Builder and connect to an Oracle database. It lists the main tools in Forms Builder like the Object Navigator, Property Palette, Layout Editor, and PL/SQL Editor. It provides steps for creating a simple form using the Data Block and Layout Wizards.
This document provides an introduction to using Oracle Forms Builder. It describes the major tools in Forms Builder like the IDE, compiler, and runtime engine. It explains how to execute forms in a web-based environment using a web browser, server, and applet. The document outlines how to launch Forms Builder and connect to an Oracle database. It lists the main tools in Forms Builder like the Object Navigator, Property Palette, Layout Editor, and PL/SQL Editor. It provides steps for creating a simple form using the Data Block and Layout Wizards.
This document provides an introduction to using Oracle Forms Builder. It describes the major tools in Forms Builder like the IDE, compiler, and runtime engine. It explains how to execute forms in a web-based environment using a web browser, server, and applet. The document outlines how to launch Forms Builder and connect to an Oracle database. It lists the main tools in Forms Builder like the Object Navigator, Property Palette, Layout Editor, and PL/SQL Editor. It provides steps for creating a simple form using the Data Block and Layout Wizards.
Download as DOC, PDF, TXT or read online from Scribd
Download as doc, pdf, or txt
You are on page 1of 34
Introduction to Oracle Forms Builder
Dr. Awad Khalil
Computer Science & Engineering Department AUC Major Forms Builder Tools Forms Builder has een Oracle!s main "orm de#elopment product "or more than $% &ears. During this time' Forms Builder applications were used in a main"rame' character(ased en#ironment' a client(ser#er en#ironment' and now in the )e en#ironment. Oracle!s De#eloper uses three di""erent components* An Integrated Design En#ironment +IDE, called Forms Builder de#elops "orms. -his tool places the desired design components into a inar& "ile with a "ile e.tension o" ."m. -he inar& "orm "ile cannot e e.ecuted until it is turned into machine code. A Forms Compiler that creates a compiled +machine language, "ile ased on the "orm inar& "ile. -his "ile has an e.tension o" ."m.. It is more common' howe#er' to compile the "ile within the Forms Builder tool. A runtime engine called Forms Ser#er e.ecutes the compiled ."m. "iles in a )e en#ironment. Forms Ser#er is a middleware product that recei#es re/uests "rom a )e rowser and dishes up a 0a#a applet ased on the "orm to the rowser Executing Forms in Web-based Environment )e applications rel& on a )e rowser and a )e ser#er. -he )e ser#er controls coordination. )hen using a "orm on the )e' the e.ecutale "ile is registered with the )e ser#er. -o e.ecute the )e "orm' a user re/uests a U12 in his )e rowser. -he U12 points to an application registered within Forms Ser#er. A listner on the )e ser#er catches this U12 re/uest and passes it to Forms Ser#er. -he Forms Ser#er locates and e.ecutes the ."m. "ile. It changes the ."m. "ile into a 0a#a applet and sends it to the )e rowser. -o e.ecute a "orm in a )e rowser' the client unit must ha#e an applet called 0Initiator. )hen an Oracle "orm is e.ecuted through the )e ' the )e ser#er storing the "orm sends the 0initiator applet to the client!s )e rowser +i" it does not alread& e.ist on the client,. 0initiator is a generic applet' which is downloaded once to the client. It is actuall& a plug(in that ensures the )e rowser can interact with Forms Ser#er. It is also used to paint the "orm within the rowser' #alidate data' and communicate with Forms Ser#er. Forms Ser#er reads and e.ecutes the ."m. "ile. Forms Ser#er communicates with the dataase and with the applet on the )e rowser. 1 Launching Forms Builders IDE One wa& to launch Forms Builder' &ou select* Start 33 All 4rograms 33 Oracle De#eloper Suite 33 Forms De#eloper 33 Forms Builder 2aunching Forms Builder opens the )elcome to the Forms Builder and then the O5ect 6a#igator' the heart o" Forms uilder. O5ect 6a#igator is a Forms Builder tool that displa&s the #arious "orm components as well as other "orm modules' menu modules' and dataase o5ects. -his tool enales &ou to select #arious "orm o5ects "or modi"ication. It also allows &ou to add and delete "orm components. )hen Forms Builder is launched' the O5ect 6a#igator displa&s one lan7 module. A module is another name "or the "orm inar& "ile that contains the application components. 2 bject !avigator 3 Logging on to the racle Database )hen starting a Forms Builder session' "irst connect to the Oracle dataase. -he dataase "urnishes much o" the in"ormation &ou need to de#elop the "orm. It supplies Forms Builder with the names o" tales and columns and each column!s data t&pe' length' and prompt properties. It also supplies constraint in"ormation that is used to set re/uired +6O- 6U22, properties and range properties. -here are se#eral methods o" connecting to Oracle' in "act' &ou can use Forms Builder "or man& tas7s without connecting to the dataase. 8owe#er' Oracle attempts to log &ou on to the dataase whene#er Forms Builder needs some in"ormation "rom the dataase. -his attempt can occur when &ou are using a wi9ard or compiling a 42:S;2 script. )hen Forms Builder attempts to log &ou on to the dataase' it displa&s a modal dialog o. re/uesting &ou to enter the "ollowing * 4 6ormall&' a de#eloper connects to Oracle when starting a Forms Builder session & per"orming one o" the "ollowing "unctions* From the menu' clic7 File:Connect 4ress the Control and 0 7e&s. -hese are IDE hot 7e&s that per"orm the same "unction as the File:Connect menu selection. For &our "irst practice session' launch Forms Builder and connect to the Oracle dataase & per"orming these steps* 2ocate and select the Forms Builder option on the Start menu. I" the )elcome to the Forms Builder dialog o. opens' clic7 the Cancel utton. )hen &ou are in the main wor7 area' log on to Oracle & selecting File:Connect menu option. Enter &our Oracle ID in"ormation into the Connect dialog o.. -his generall& consists o" the Oracle ID' password' and connect string. I" &ou are using an Oracle dataase that is installed on &our 4C' the de"ault ID is scott:tiger and a connect string is needed. Clic7 the Connect utton. -he dialog o. disappears when &ou are connected. Forms Builder IDE Tools Forms Builder has tools that are used to uild "orms* O5ect 6a#igator* 2ocates and na#igates to an& "orm component. Doule(clic7ing an& o5ect in the O5ect 6a#igator causes Forms Builder to displa& the selected o5ect within the appropriate Forms Builder tool. -he O5ect 6a#igator can also e used to create' delete' cop&' and rename "orm components. +can e launched & clic7ing F<,. 4ropert& 4allete* Used to de"ine special characteristics o" the "orm!s components. Each component has a di""erent set o" properties. E.amples o" component properties include case 5 restriction' length o" #alue' data t&pe' or prompt #alue. 4roperties can e used to sustantiall& control a "orm!s eha#ior. Doule(clic7ing an o5ect in the O5ect 6a#igator generall& opens the 4ropert& 4allette tool. +can e launched & clic7ing F=,. 2a&out Editor* It paints the "orm. -his tool allows &ou to mo#e and arrange "orm o5ects' set "ont and "ill colors' add components to the "orm' and add a oilerplate. Doule(clic7ing ang graphic component in the O5ect 6a#igator causes the la&out Editor to displa& a can#as that contains the graphic o5ects. +can e launched & clic7ing F$,. 42:S;2 Editor* Used to write the 42:S;2 scripts needed & a "orm. -hese 42:S;2 scripts are placed in triggers associated to a "orm o5ect or into program units that are emedded in the triggers. A trigger is a 42:S;2 code loc7 whose e.ecution is ased on a "orm e#ent' such as doule(clic7ing a "orm o5ect' na#igating to another te.t item' or pressing an F 7e&. 4rogram units are 42:S;2 scripts that are named and stored within a "orm or in a dataase. +can e launched & clic7ing F>>,. "ro#erties "alette La$out Editor 6 "L%&'L Editor (reating a &im#le Form )sing the Data Bloc* and La$out Wi+ards Forms are composed o" a #ariet& o" o5ects' ut each "orm must ha#e the "ollowing three components* Data Bloc7* this is the "orm o5ect that contains data elements. -he data loc7 is usuall& closel& related to a dataase tale or #iew. -he data loc7 elements recei#e dataase #alues "or displa&' update' or deletion. Data loc7s also recei#e in"ormation that has een input "or insertion into the dataase. Data loc7s generate d&namic S;2 statements +I6SE1-' U4DA-E' and DE2E-E, that interact with the dataase. Can#as* -his is the "orm o5ect that is shown to the user and is displa&ed in the 2a&out Editor. All displa&ed "orm components must e placed on a can#as to e displa&ed. Can#ases also contain graphic s&mols and a oilerplate. )indow* -his is the "orm o5ect that displa&s the can#as. 7 -hese three components can e created manuall& using the O5ect 6a#igator' ut it is much more common to use the Data Bloc7 and 2a&out )i9ards' especiall& "or newl& created "orms. (reating a Form Module -he "irst tas7 in creating a "orm is to create a "orm module. A "orm module is a inar& "ile that holds the "orm components. -o determine whether a "orm module has een rought into the Forms Builder session' &ou must displa& the O5ect 6a#igator. -he O5ect 6a#igator displa&s a hierarchical list o" parent and child o5ects. For e.ample' i" we loo7 at the O5ect 6a#igator shown e"ore' we ca recogni9e si. o5ects +or parents, on the le"t side o" the O5ect 6a#igator* FO1?S' ?E6US' 42:S;2 2IB1A1IES' OB0EC- 2IB1A1IES' BUI2-(I6 4ACKA@ES' and DA-ABASE OB0EC-S. Under the FO1?S o5ect is a node called ?ODU2E>. this is one instance o" the FO1?S parent o5ect and is a child node. -he O5ect 6a#igator allows &ou to ha#e multiple child nodes. Under the ?ODU2E> node are additional child nodes* -1I@@E1S' A2E1-S' A--AC8ED 2IB1A1IES' DA-A B2OCKS' and so on. -heses are "orm o5ects or components that ma7e up a "orm. -he O5ect 6a#igator la&s out all a#ailale o5ects in this hierarch& o" parent and child o5ects or nodes. I" a "orm module e.ists' &ou see the name o" the "orm as a FO1?S o5ect child node. Under the FO1?S node is a child node called ?ODU2E>. -his is a new created "orm module read& "or modi"ication. -he "orm module is named ?ODU2E> & de"ault. Forms Builder generates a new de"ault name whene#er a new module is created' and the de"ault name changes to the name o" the "ile when the module is sa#ed. -he O5ect 6a#igator can contain multiple "orm modules. Selecting an& "orm module child node causes that "orm module to e the current module. E.isting "orm modules can e rought into Forms Builder in two wa&s* Using the File:6ew menu option to create a new "orm module. Using the File:Open menu option to retrie#e an e.isting module "rom the "ile s&stem. )sing the Data Bloc* Wi+ard to (reate a Data Bloc* 6ow that &ou ha#e seen a "orm module' &ou are read& to create the "irst o" the three mandator& o5ects listed pre#iousl&* the data loc7. Use the Data Bloc7 )i9ard to create new data loc7s and modi"& them. -he wi9ard can e launched in three wa&s* 8 Use the -ools:Data Bloc7 )i9ard menu option. Clic7 the DA-A B2OCKS node in the O5ect 6a#igator. Clic7 the Create tool on the le"t toolar. -he icon "or this tool has a green plus sign. -his option causes a dialog o. to open. Aou are prompted to either launch the Data Bloc7 )i9ard or to uild it manuall&. Use the )elcome to the Forms Builder dialog o. & clic7ing the Use the Data Bloc7 )i9ard radio utton. As stated earlier' the Data Bloc7 )i9ard can e used to create a new data loc7 and modi"& an e.isting loc7. I" &ou selected an e.isting loc7 in the O5ect 6a#igator' the Data Bloc7 )i9ard displa&s in"ormation aout this data loc7. I" &ou want to create a new data loc7' e sure that an e.isting data loc7 is not selected. Forms generall& contain se#eral data loc7s. A"ter creating the "irst data loc7' it is #er& eas& to attempt to create a second data loc7 while the original is still selected. I" &ou launch the Data Bloc7 )i9ard with a data loc7 selected' the wi9ard modi"ies the currentl& selected data loc7 and eliminates the settings that &ou ha#e estalished. -his is a common error "or no#ice de#elopers. -he& launch the Data Bloc7 )i9ard while a data loc7 is selected. )hen the& are "inished' the components o" the "irst data loc7 are gone' lea#ing them modi"ied. I" &ou want to create a new data loc7' e sure that a non(data loc7 "orm module o5ect is selected e"ore launching the Data Bloc7 )i9ard. -his causes Forms Builder to create a new data loc7 9 -he Data Bloc7 )i9ard consists o" a series o" modal dialog o.es or pages that allow &ou to set a numer o" data loc7 properties or speci"ications. -he )elcome to the Data Bloc7 )i9ard page appears "irst. -here is a Displa& this page ne.t time chec7 o. in the lower(le"t corner o" the page. Clic7ing this o. to clear to clear the chec7 mar7 pre#ents this dialog o. "rom appearing. Each o" the wi9ard pages has Bac7 and 6e.t uttons that allow &ou to mo#e etween the wi9ard pages. Clic7ing the 6e.t utton on the Data Bloc7 )i9ard page opens the "irst important wi9ard page. &etting the Bloc*s Data &ource T$#e -he ne.t Data Bloc7 )i9ard page' the -&pe page is used to enter the data loc7!s data source t&pe. -his dialog o. has two radio uttons* -ale or Biew and Stored 4rocedure. Selecting the -ale or Biew option sets up the data loc7 to use an Oracle tale or #iew. A tale is a dataase o5ect that stores records. Biews are stored SE2EC- statements that create and return result set or deri#ed tale. Stored procedures are named 42:S;2 scripts that reside in the dataase. -he& can e used in con5unction with a 1e" Cursor and used as a data source. -he -ale or Biew option is the more common option -he ne.t wi9ard page is used to set the data source. -his page does not appear unless &ou are logged on to Oracle. I" &ou were not pre#iousl& logged on' &ou are prompted to log on to Oracle e"ore the page appears. 6ote the "ollowing "eatures o" this page* -ale or #iew* -e.t item used to document the name o" the data source tale or #iew. Browse* Button that launches the -ales dialog o. used to search and identi"& tales and 10 #iews "or the -ale or Biew te.t item. 1e"resh* Button that populates the A#ailale Columns list o.. Use this utton onl& i" a dataase change occurs while the wi9ard is open. En"orce data integrit&* Chec7 o. that causes Forms Builder to add the target tale!s dataase constraints to the data loc7 item properties. A#ailale Columns* 2ist o. displa&ing columns a#ailale "or the data loc7. Dataase Items* 2ist o. displa&ing columns that will e placed in the data loc7. ?o#e uttons* Four uttons that appear etween the list o.es. -he& are used to add and remo#e columns "rom the list o.es. Single(arrow tools mo#e onl& the selected columnsC doule(arrow tools mo#e the entire contents o" the list o.. Doule(clic7ing an& list o. column mo#es it to another list o.. -he Delete 7e& can also e used to remo#e columns "rom the Dataase Items list o.. 11 12 13 It is not necessar& to place all a#ailale columns into the data loc7C howe#er' an& tale column that contain a 6O- 6U22 constraint must e selected to per"orm D?2 operations without errors. Clic7ing an& list o. o5ect on the -ales dialog o. and clic7ing the OK utton populates te.t items on the Data Bloc7 )i9ard -ale page. -he selected tale name will appear in the wi9ard -ale or Biew te.t item. In addition' the wi9ard page' A#ailale Columns list o.' will e populated with the selected tale!s columns. -he -ales dialog o. is a common Oracle tool. Oracle is a distriuted dataase' and the target data can e located on a #ariet& o" Oracle installations. -he dialog o. aids &ou in searching the #arious installations and in locating the appropriate data source. 6ote the "ollowing dialog o. characteristics* Displa&* A series o" chec7 o.es used to "ilter the dataase o5ects. Current user* Allows o5ects owned & &ou' the de#eloper' to appear in the list. Other users* Allows o5ects on which &ou ha#e een granted pri#ileges to appear. -ales* Allows dataase tales to appear. Biews* Allows #iews to appear. S&non&ms* Allows s&non&m names to appear. A s&non&m is another name "or a dataase o5ect. Dataase o5ect list o.* Displa&s the results o" a dataase search ased on the #alues in the Displa& chec7 o.es. -he list o. has two components* -AB2E and O)6E1. -AB2E contains the name o" the o5ect. O)6E1 lists the Oracle ID that owns the o5ect. Blan7 #alues indicate the current user owns the o5ect. )sing the La$out Wi+ard to "lace Data Bloc* Items on a (anvas 14 A"ter the data loc7 is created along with the data loc7 items associated to tale columns' the items must e placed on a can#as. -his is generall& done using the 2a&out )i9ard' which can e launched "rom the Data Bloc7 )i9ard Congratulations page or "rom a menu option. Data loc7 items are onl& displa&ed & placing them on a can#as and displa&ing the can#as within a window. All o" these items can e created manuall& using the Create tool in the O5ect 6a#igator. It is easier and /uic7er' howe#er' to use the 2a&out )i9ard to associate the data loc7 items with a can#as. As a "orm de#eloper' &ou use the 2a&out Editor "or the "ollowing tas7s* Create a can#as "or the "orm i" one has not een created. Create additional can#ases i" needed. Create ta pages' which are special t&pes o" can#ases that o#erla& each other. Associate a data loc7 item to a can#as or ta page. Set the data item!s prompt or lael te.t. A prompt is the oilerplate te.t that descries a "orm item. Set the data item!s width. Set the asic data la&out. Set the data displa& properties' including the numer o" records displa&ed. Setting these properties goes a long wa& toward "ormatting &our "orm. -he 2a&out )i9ard is launched & either o" these methods* 15 Choosing the Create the data loc7' and then call the 2a&out )i9ard option on the Data Bloc7 )i9ard Congratulations page. Clic7ing -ools:2a&out )i9ard on the menu. -he "irst 2a&out )i9ard page is the )elcome page. -his panel does not ser#e an& real purpose and can e disaled & clic7ing the Displa& this page ne.t time chec7 o. to clear the chec7mar7. &etting the (anvas -he Can#as wi9ard page is the "irst page o" importance. It identi"ies the can#as that is associated to the data loc7 items. -his can e a new can#as or an e.isting can#as +s can#as can displa& multiple data loc7s,. -he Can#as wi9ard page is also used to determine the t&pe o" can#as. Fi#e t&pes are a#ailale* content' stac7ed' #ertical toolar' hori9ontal toolar' and ta. Content is the asic "orm can#as and is the de"ault. All "orms must ha#e at least one content can#as. 6ote the "ollowing Can#as wi9ard page "eatures* Can#as* A pull(down list o" 6ew Can#as option and all pre#iousl& created can#ases. Aou must choose a can#as on which to place the data loc7 items. -&pe* A pull(down list o" can#as t&pes. -a 4age* A pull(down list o" new ta page options and all e.isting ta pages. -he #alues in this list pertain to the selected can#as' and the list o. is acti#e onl& i" the can#as is a ta can#as. (anvas Wi+ard "age 16 Identi,$ing Data Bloc* Items ,or Dis#la$ -he Data Bloc7 wi9ard page "ollows the Can#as wi9ard page and is used to set two data loc7 item properties* Can#as and Bisile. -he properties are not displa&ed on the page' ut mo#ing an item "rom the A#ailale Items list to the Displa&ed Items list sets the propert& #alues. -he "ollowing descries what occurs & mo#ing an item to the Displa&ed Items list* Can#as* An item propert& that associates the item to the can#as. I" this item has a 6U22 #alue it does not appear. I" a Can#as propert& contains a con#as name' it appears on the named can#as. ?o#ing an item to the Displa&ed Items list sets the Can#as propert& to the can#as identi"ied on the Can#as page. Bisile* An item propert& that determines whether the item appears when the "orm is e.ecuted. I" this #alue is 6O' the item appears in the 2a&out Editor +i" the Can#as propert& is set to a can#as, ut not when the "orm is e.ecuted. A #alue o" AES causes the item to appear. ?o#ing an item to the Displa&ed Items list sets this propert& to AES. Data Bloc7* 4ull(down list that displa&s the "orm!s data loc7s. -his setting determines the data loc7 suppl&ing the items. A#ailale Items* 2ist o. displa&ing data loc7 items a#ailale "or displa&. -hese items will con"orm to the selected data loc7. 17 Displa&ed Items* 2ist o. displa&ing data loc7 items that will e displa&ed. Item -&pe* 4ull(down list that sets the selected item!s t&pe. -he de"ault is -e.t Item. E.amples o" other t&pes are Displa& Item' Chec7 Bo.' and 4op 2ist. Biew* 4ull(down list used with a radio group item to set up radio uttons. Data Bloc* Wi+ard "age &etting the Item "rom#t and Width -he Items wi9ard page sets prompt te.t' as well as the width and height o" the displa&ed data items. 4rompt -e.t is the oilerplate that descries the data item and appears ad5acent to an item on the can#as. -he de"ault prompt te.t is ased on the dataase column names. Underscores and special characters contained in the column name are stripped out o" the name' lea#ing the de"ault. -he width' height' and prompt te.t #alues are data item properties and can e reset using the 4ropert& 4alette. -he Items wi9ard page contains a single list o. composed o" "our #alues per row* 6ame* Data loc7 item names. -his #alue cannot e changed. 18 4rompt* Data item!s prompt te.t. -his #alue can e changed. )idth* Data item!s width. -his #alue can e changed. 8eight* Data item!s height. -his #alue can e changed. Items Wi+ard "age &etting the &t$le -he St&le wi9ard page determines the initial la&out o" the displa&ed data items. -he page consists o" two st&le setting radio uttons* Form and -aulate. )ith a Form st&le' a record!s items are displa&ed in a numer o" rows. -his st&le wor7s est when the "orm is a regular entit& instance. )ith a taular st&le' a numer o" records are displa&ed in a series o" columns. Each row in the la&out is a dataase record. -his st&le wor7s est when the "orm is to displa& multiple rows. Data entit& attriutes in a one(to(man& relationship are o"ten displa&ed on can#ases that ha#e a comination o" "orm and taular st&les. -he data "rom the parent entit& +"or e.ample' DE4A1-?E6-, is #iewed in "orm la&out' and the data "rom the child entit& +"or e.ample' E?42OAEE, is #iewed in the taular st&le. Forms Builder calls this a master(detail(la&out. &t$le Wi+ard "age 19 &etting the !umber o, -o.s/ Frame Title/ Distance Bet.een -ecords/ and the &crollbar -he ne.t to last 2a&out )i9ard page is the 1ow page' which is used to set two data loc7 properties* 1ecords Displa&ed and Scrollar. -he de"aults "or these properties are > and 6O' meaning onl& one data loc7 record is displa&ed' and the can#as does not ha#e a scrollar "or the data loc7!s records. Aou generall& use these settings on "orm st&le la&outs. -aular st&le la&outs generall& displa& multiple records. -o displa& multiple records' set the 1ecords Displa&ed option to a #alue greater than >. it is #er& hand& to ha#e a scrollar "or a taular st&le la&outs. Clic7 the Displa& Scrollar chec7 o. to displa& a scroller on the can#as. -he 1ows page is also used to set "rame properties. Frames are can#as child o5ects used to "ormat sets o" attriutes and are discussed later. 8owe#er' "or now &ou should understand that the Frame -itle and Distance Between 1ecords properties can e set on this wi9ard page. -he Frame -itle propert& is a oilerplate that descries the displa&ed items. -he Distance Between 1ecords causes space to appear etween successi#e rows o" records. -o.s Wi+ard "age 20 (om#leting the La$out and 0ie.ing the Form bjects -he Congratulations page is the last page o" the 2a&out )i9ard. Clic7ing the Finish utton causes a numer o" "orm o5ects to e created and properties set. Aou can mo#e ac7wards through the wi9ard chec7ing the settings e"ore clic7ing the Finish utton' and each o" the pages has a Finish utton' so &ou can "inish creating the la&out on an& wi9ard page. A"ter completing the tas7s in the Data Bloc7 and 2a&out )i9ards' &ou ha#e de#eloped all the "orm o5ects needed to e.ecute the "orm in client(ser#er or )e en#ironments. -he "orm now has the "ollowing power"ul capailities* 1ecords can e added to the dataase. Dataase records can e modi"ied. 1ecords can e deleted "rom the dataase. E.tremel& comple. /ueries can e e.ecuted against the dataase. 21 (ongratulations Wi+ard "age -he "ollowing "igure illustrates the "orm that was created using the settings in the pre#ious "igures. -he "orm is displa&ed in the 2a&out Editor. 6otice that the data loc7 items are located in se#eral rows' as is the "orm st&le. -o the le"t 2a&out Editor is the O5ect 6a#igator displa&ing the #arious "orm o5ects that are listed here. 22 (om#iling and &aving the Form Modules A"ter creating the "orm modules' the& must e con#erted to machine code & compiling the module. -his is generall& done within Forms Builder' ut an e.ternal product called Forms Compiler can e used. Forms Compiler is generall& not used when &ou are de#eloping the "orm' ecause its main purpose is to compile e.isting "orms a"ter a product upgrade. Using Forms Builder' a "orm "ile can e compiled in these three wa&s* Clic7 the 4rogram:Compile ?odule menu option. 4ress the ControlD- +CrtlD-, hot 7e&s. E.ecute the "orm within Forms Builder using the pre"erence option that automaticall& compiles the "orm e"ore e.ecuting it. Compiling the "orm creates an e.ecutale "ile with a "ile e.tension ."m.C howe#er' it does not sa#e the inar& ."m "ile. It is possile to sa#e an e.ecutale "ile ut no source code "or the "ile. In order to sa#e the inar& "ile' &ou must sa#e the "ile. -his is done in one o" two wa&s* Clic7 the File:Sa#e As or File:Sa#e menu options. Clic7 the Sa#e tool on the toolar. Launching a Form )sing racle Forms Builder -untime A"ter &ou ha#e de#eloped and compiled a "orm' &ou can run it. Forms are e.ecuted & sending a U12 re/uest to Forms Ser#er +or launching Forms 1untime "or client(ser#er applications,. Forms Builder contains a tool that enales &ou to launch the "orm "rom within the IDE so that &ou can run and test the "orm while &ou are de#eloping it. Forms Builder allows &ou to e.ecute the "orm as a )e application. Be"ore &ou can e.ecute the )e "orm using Forms Builder' &ou must start a listener. -he listener wor7s in con5unction with the internal Forms Builder )e ser#er. )hen the listener identi"ies a re/uest "rom a )e rowser' it noti"ies the Forms Ser#er o" the )e ser#er. Forms Ser#er then ser#es up the re/uested "orm application and sends it to the )e rowser. I" &ou are e.ecuting a "orm "or the "irst time on &our 4C' the 0Initiator applet is downloaded. -he Start OC=0 Instance window that launches the listener. -his window does not close' so &ou should minimi9e it. 4ractice launching the "orm "rom within Forms Builder & "ollowing these steps* Use the O5ect 6a#igator or the 2a&out Editor to select an& o" the target "orm!s components. Selecting a component causes that "orm to e set as the current "orm' and Forms Builder alwa&s e.ecutes the current "orm. Be sure that the listener is started e"ore launching the "orm. I" it does not e.ist on &our wor7station' Forms Builder downloads 0Initiator the "irst time &ou launch a "orm. Clic7 the 1un Form tool on the hori9ontal toolar or select the 4rogram: 1un Form menu 23 selection. The (12 Instance Windo. (reating Em#lo$ee Data Bloc* .ith Tabular &t$le Form #erating Modes An Oracle "orm has a large amount o" "unctionalit& uilt into it & de"ault. It is #er& important "or &ou to understand the de"ault eha#ior' ecause it will e &our tas7 as a de#eloper to enhance 24 or eliminate portions o" this eha#ior. Oracle "orms and all other computer "orms ha#e three asic operating modes* -he "orm prompts the user "or #alues that determine which records are to e displa&ed. -he "orm displa&s the records retrie#ed "or #iewing or updating. -he "orm allows the user to add new records. an Oracle "orm is not di""erent. An Oracle "orm also has three modes' as "ollows* 6O1?A2* -he data loc7 can e used to enter new records or to update and delete displa&ed records. E6-E1 ;UE1A* -he data loc7 prompts the user to enter #alues that are used to identi"& the displa&ed records. ;UE1A* -he data loc7 retrie#es records "or the "orm. -hese modes do not pertain to the "orm itsel"C the& indicate the mode o" a data loc7 on the "orm. A "orm can contain multiple data loc7s' and each data loc7 can e in a di""erent mode. -he "irst thing &ou must learn is how to distinguish which mode the data is in' and this is sometimes #er& con"using. )nderstanding the !-M3L Mode Data loc7s that are in the 6O1?A2 mode can e used to add records or to update records. -his ma& sound strange' since it seems illogical to e ale to add and update at the same timeC howe#er' it is true. A data loc7 in the 6O1?A2 mode alwa&s has at least one record in which the user can add a new record' and this is true e#en i" the data loc7 is displa&ing e.isting records. 25 -he "ollowing "igure illustrates this "eature. -he "igure depicts an e.ecuted )e "orm' which contains an Emplo&ee data loc7. -he "orm uses a taular st&le containing multiple records rather than a "orm st&le la&out. A /uer& was e.ecuted on the data loc7 returning records. -he data loc7 is in the 6O1?A2 mode. -he displa&ed Emplo&ee tale records can e updated & placing the cursor in an& o" the te.t items and entering the data. A new record can e added & placing the cursor in the row immediatel& "ollowing the last Emplo&ee record and entering the data. -hus' the data loc7 can e used to update e.isting #alues and add new one!s at the same time. 26 Aou can alwa&s add records to a data loc7 that is in the 6O1?A2 mode. I" the "orm is displa&ing one record in a "orm st&le la&out or $% records in a taular la&out' &ou can press the Down arrow 7e& to mo#e the cursor to the ne.t record. Data loc7s' whether "orm or taular st&le' contain all the records returned & a /uer&. Forms Builder alwa&s adds a row that can e used to insert records a"ter the last record in the data loc7 result set. 4ressing the Down arrow 7e& scrolls &ou through the record set' until the lan7 row is displa&ed. Using the Form st&le can sometimes e con"using. -his st&le is used when one record o" the result set is displa&ed. )hen a "orm is "irst displa&ed' no data appears. -he displa&ed data loc7 is in the 6O1?A2 mode. Aou ma& enter #alues into the displa&ed te.t items i" &ou chooseC howe#er' do not do so at this time. -he "ollowing "igure illustrates the "orm when is "irst displa&ed* E.ecute a /uer& & pressing the ControlDF>> 7e&s. -hese are hot 7e&s that cause Forms Builder to create and e.ecute a SE2EC- statement. -he results o" the SE2EC- statement are returned to the data loc7. -he "ollowing "igure illustrates the "orm a"ter the /uer& returns records. -his "orm was in the ;UE1A mode while it retrie#ed records to the data loc7. It is now in the 6O1?A2 mode . -he "orm displa&s a numer o" records' ecause it is a taular st&le that displa&s multiple records. In some cases' the /uer& could return more records than can e displa&ed & the "orm. -his is especiall& true "or a "orm in the "orm st&le. Aou can #iew the additional records & pressing the Down arrow 7e&. -his causes the "orm to displa& the ne.t result set record. -he Up arrow 7e& causes the "orm to displa& the pre#ious record. 4ress the Down arrow 7e& repeatedl& until &ou ha#e scrolled through the entire result set 27 and a lan7 record is displa&ed where &ou can enter data o" a new record. Sa#e the record & pressing the ControlDS 7e&. 4ress the Down 7e& to ma7e another lan7 record appear. Forms Builder aCwa&s adds a lan7 record at the end o" the result set. 2ast' &ou can close the "orm & closing the )e rowser. )hen &our result set is large and &ou want to a#oid scrolling through the result set to "ind the lan7 record' &ou can add a lan7 record at the current data loc7 record location & per"orming one o" the "ollowing operations* Select the 1ecord:Insert menu option "rom the de"ault menu. Clic7 the Insert 1ecord tool on the de"ault toolar' Clic7 the appropriate "unction or hot 7e&. )nderstanding the E!TE- ')E-4 and ')E-4 Mode -he data loc7 is in the E6-E1 ;UE1A mode when it is prompting the user to enter a #alue. -here is one speci"ic identi"ier "or this mode. In the lower(le"t corner in the "orm status line is the "ollowing message* EEnter a query; press Ctrl+F11 to execute, F4 to cancel.F It is e.tremel& common to mista7e the E6-E1 ;UE1A mode "or the 6O1?A2 mode with no data loc7 records displa&ed. )hen a data loc7 +or "orm, is "irst displa&ed' it is placed in the 6O1?A2 mode with no records displa&ed. It loo7s #irtuall& identical to the "orm when it is in the E6-E1 ;UE1A mode i" the #alues had not een entered' e.cept "or the message at the ottom( le"t o" the "orm. It is common operator error to mista7e the two modes' enter a row o" #alues' and then tr& to sa#e the #alues. Forms Builder issues an error message' ecause &ou cannot sa#e records in the E6-E1 ;UE1A mode. Users get upset ecause the& ha#e entered a row o" data 28 that will shortl& e lost. It is important to 7now the current mode' and the message at the ottom o" the screen is the onl& indication o" the di""erence etween the modes when this condition e.ists. -he purpose o" the E6-E1 ;UE1A mode is to de#elop the SE2EC- statement )8E1E clause. )8E1E clauses identi"& speci"ic records that are to e retrie#ed "rom the dataase. SE2EC- statements are S;2 commands that instruct the Oracle dataase to locate and retrie#e records. Forms Builder creates d&namic SE2EC- statements ased on the #alues or arguments entered in the E6-E1 ;UE1A mode. -he ;UE1A mode occurs a"ter the user has entered the )8E1E clause arguments into the data loc7 row and attempts to retrie#e records "rom the dataase that match the arguments. 4lacing the "orm into the ;UE1A mode causes a SE2EC- statement to e generated and e.ecuted & placing the data loc7 into the ;UE1A mode. -he SE2EC- statement will create )8E1E clause arguments "or an& #alue entered into the data loc7. -he data loc7 then passes the SE2EC- statement to the Oracle. Oracle generates the result set and passes it ac7 to the data loc7. Oracle returns all records that match the )8E1E clause arguments or no records at all. -he data loc7 is placed in the E6-E1 ;UE1A mode when &ou per"orm one o" these procedures* Clic7 the ;uer&:Enter menu option. Clic7 the Enter ;uer& tool on the de"ault tool ar. 4ress the appropriate "unction 7e&C FG in the client(ser#er en#ironment and F>> in the )e en#ironment. Use one o" the "ollowing procedures to place the data loc7 in the ;UE1A mode in which it e.ecutes the SE2EC- statement* Clic7 the ;uer&:E.ecute menu option. Clic7 the E.ecute ;uer& tool on the de"ault toolar. 4ress the appropriate "unction 7e&C FH in the client(ser#er en#ironment and ControlDF>> in the )e en#ironment. -he ;UE1A mode lasts onl& as long as the SE2EC- statement is wor7ing. )hen result set is returned' the "orm is placed in one o" two modes* I" it returns records' the data loc7 is in the 6O1?A2 mode. I" it does not return records' the data loc7 is placed in the E6-E1 ;UE1A mode with the "ollowing message* EF1?(=%<%>*;uer& caused no records to e retrie#ed. 1e(enter.F -his message is prompting "or di""erent )8E1E clause arguments. 29 (hanging Modes (urrent mode (haracteristics o, the current mode !est mode or #rocedure Techni5ue NORMAL mode: no records displayed Data block is empty of all records and no ENTER QUERY messae appears !nsert ne" record Add #al$es to t%e first ro" of t%e data block& NORMAL mode: records displayed Data block displays records !nsert ne" record '& (croll to t%e end of t%e record set& )& (elect t%e 1ecord:Insert men$ option from t%e defa$lt men$& *& +lick t%e Insert 1ecord tool on t%e defa$lt toolbar& ,& -ress t%e appropriate f$nction key: FH for client.ser#er and ControlDF>> for /eb& NORMAL mode: records displayed Data block displays records Update an e0istin record -lace t%e c$rsor on a displayed #al$e and modify& NORMAL mode: records displayed Data block displays records Delete an e0istin record -lace t%e c$rsor on any #al$e on t%e taret ro" and perform one of t%e follo"in: '& (elect t%e 1ecord:1emo#e men$ selection& )& +lick t%e 1emo#e 1ecord tool on t%e toolbar& *& -ress t%e appropriate f$nction key: Shi"tDFI for client.ser#er and ControlDUp for /eb& 30 NORMAL mode No records are displayed and t%e 1$ery messae is not displayed or records are displayed in t%e data block& -ermanently sa#e t%e c%anes 2Oracle does not sa#e records $ntil a commit command is iss$ed3& '& (elect t%e Action:Sa#e men$ option& )& +lick t%e Sa#e tool on t%e toolbar& *& -ress t%e appropriate f$nction key: F>% for client.ser#er and ControlDS for /eb +$rrent mode +%aracteristics of t%e c$rrent mode Nest mode or proced$re Tec%ni1$e NORMAL mode No records are displayed and t%e 1$ery messae is not displayed or records are displayed in t%e data block& -lacin t%e data block in t%e ENTER QUERY mode& '& (elect t%e Q$ery4Enter men$ selection& )& +lick t%e ENTER QUERY tool on t%e toolbar& *& -ress t%e appropriate f$nction key: 56 for client.ser#er and 5'' for /eb& NORMAL mode No records are displayed and t%e 1$ery messae is not displayed or records are displayed in t%e data block& +lose t%e form& 2yo$ can only close t%e form "%en t%e data blocks are in t%e NORMAL mode3 '& (elect t%e A+T!ON4E0it men$ selection& )& +lick t%e E0it tool on t%e toolbar& *& -ress t%e appropriate f$nction key: +ontrol71 for client.ser#er and 5, for /eb& ENTER QUERY mode Eit%er of t%e t"o 1$ery messaes are displayed& QUERY mode 2e0ec$tin t%e 1$ery and placin t%e data block in t%e NORMAL mode3 '& (elect t%e Q$ery4E0ec$te men$ selection& )& +lick t%e E0ec$te Q$ery tool on t%e toolbar& *& -ress t%e appropriate f$nction key: 58 for client.ser#er and +ontrol75'' for /eb& QUERY mode No records are displayed and t%e 1$ery messae is not displayed or records are displayed in t%e data block& NORMAL mode "it% no records displayed& '& (elect t%e Q$ery4+ancel men$ selection& )& +lick t%e +ancel Q$ery tool on t%e toolbar& *& -ress t%e appropriate f$nction key: +ontrol71 for client.ser#er and 5, for /eb& ,& +lick t%e /indo"s +lose tool in t%e $pper.ri%t corner of t%e "indo"& Filtering -ecords From a Database )sing a Form 6ow that &ou 7now how to e.ecute a /uer& and return records to the data loc7' it is time to learn how to enter arguments "or the /uer&!s )8E1E clause. -he most cle#er part o" an Oracle "orm is its ailit& to accept sophisticated search arguments. Each item in the data loc7 can ecome an argument in the )8E1E clause o" the SE2EC- statement issued & the data loc7. It is possile to enter a #alue o" Khalil and a #alue o" SJ into the "orm. )hen the /uer& is e.ecuted' the "orm created the "ollowing )8E1E clause and added it to the issued SE2EC- statement* )here 2name K LKhalil! And Fname li7e LAJ! -he result o" the "orm action was to retrie#e emplo&ee records that had an emplo&ee 2ast 31 name +2name, #alue o" Khalil and a 5o that started with the character S. an& "orm item that contains a #alue is added to the )8E1E clause' and an& item that has a lan7 or 6U22 #alue is omitted. -hus' i" &ou want to return all records' do not place an& arguments into the "orm. An Oracle "orm also allows &ou to emplo& all o" the operators and "unctions that are a#ailale in Oracle S;2. Aou can enter operators such as* 3' M' NK' 6O-' 2IKE' or I6. Aou can also emplo& an& o" Oracle!s arra& o" "unctions such as* SUBS-1' ?O6-8SOBE-)EE6' -OO6U?BE1' SOU6DEP' 2E6@-8' or U44E1. In "act' &ou can e#en enter a SE2EC- statement as a #alue. -he "orm will use this as a su/uer& or a correlated /uer& in its issued SE2EC- statement. I" entering #alues into a te.t item is not con#enient' or the data source tale has columns not contained in the data loc7' &ou can launch an editor that alows &ou to write a longer argument and additional conditions. Aou can use the And and Or 7e&words to create comple. search criteria as needed. )sing #erators in a Forms &earch 0alues In pre#ious section' it was noted that arguments can e entered directl& into a displa&ed item when the data loc7 is in the E6-E1 ;UE1A mode. )hen this happens' Oracle uses an e/ual sign +K, as the e#aluation operator. Sometimes it would e hand& to use a di""erent e#aluation operator' ut this a prolem. I" the argument is EM L?!F +greater than ?, were entered directl& into a te.t item' the SE2EC- statement would not recogni9e the greater than sign +M, as an operator. It would consider it a #alue. -he )8E1E clause would loo7 similar to this* )here Fname K LM L?!! -he /uer& will proal& not return a #alue. -he Q s&mol mechanism is needed to tell the "orm that the inputted #alue contains an operator. )hen &ou enter this s&mol as the "irst character o" the #alue' Oracle treats the "ollowing e.pression as )8E1E clause condition rather than literal #alues. For e.ample' to retrie#e all emplo&ee records with an emplo&ee name +ename, #alue greater than or e/ual to ?' enter the "ollowing into the Fname te.t item* Q MK L?!. -his creates the "ollowing )8E1E clause* )here Fname M L?! 32 )sing the Text Items Editor Entering the #alues directl& into the te.t item can e cumersome. E#en though the /uer& length is long' the #iewing width o" the te.t item will not match this length. -he user will not e ale to see the entire condition. Forms Builder!s -e.t Items Editor can e called to enter sophisticated search arguments. -his can e easier to use than entering search arguments into a te.t item' ecause &ou can see the entire e.pression. -o launch the editor' place &our cursor into an& o" the data loc7 items while it is in the E6-E1 ;UE1A mode and per"orm one o" the "ollowing steps* Clic7 the Edit:Edit menu option. 4ress the appropriate "unction 7e&* ControlDE "or oth client(ser#er and )e. 33 )sing the 'uer$%Where Dialog Box An Oracle has one other tool that &ou can use to "ilter the records ' the ;uer&:)here dialog o.. It is used to write the Entire SE2EC- statement )8E1E clause. -his tool is launched &* 4lacing an +&, into an& o" the te.t items' and E.ecuting the /uer&. 34