Vous êtes sur la page 1sur 88

Shik Mahamood Ali Forms

Definition Forms used for presenting and manipulating data can be developed. It is GUI used for developing client server database application. .FMB .FMT .FMX Form Module Binary Form Module Text Form Module xecutable

COMPONENTS OF FORMS !.Form Builder It is used to create a form. T"e design and layout of data entry screens t"e creations of event driven #$%&'$ code used for data validation and navigate can be done via form builder. (.Form )ompiler It is re*uired to compile t"e file created in form builder and create a binary file+ ,"ic" can be executable form runtime. -.Form .untime It is used to run t"e complied code created by forms compiler. COMPONENTS OF FORM BUILDER !. /b0ect 1avigator It is "ierarc"ical bro,sing and editing interface t"at enables you locate and manipulate application ob0ects *uic2ly and easily. (.#roperty #alette It is used set and modify t"e properties for all ob0ects in form modules. -.$ayout ditor It is grap"ical design facility for creating and arranging interface items and grap"ical ob0ects in your application. 3.#$ % &'$ ditor It is t"e integrated functionality of oracle procedure builder t"at exists ,it" in form builder. It provides4 Development of Trigger+ #rocedures+ Functions and #ac2ages Development of libraries to "old #$%&'$ program unit. FORM MODULE TYPES !.Form Module It is a collection of ob0ectives suc" as bloc2+ canvas+ items and event based #$%&'$ code bloc2s called trigger . (.Menu Module It is a collection of menu items. It can be main menu or sub menu. -.#$ % &'$ $ibraries T"e library module is a collection of #$%&'$ function and pac2age stored ion a single library file. T"is library file is t"e attac"ed to form % menu modules. 5ll ot"er ob0ects in t"e form or menu can no, access s"are t"e collection of #$%&'$ functions and procedures. 3./b0ect $ibraries

Shik Mahamood Ali 2 It is a collection of form ob0ects t"at you can use in ot"er modules. 6ou can create it to store+ maintain and distribute standard ob0ects t"at can be reuse across t"e entire development organi7ation. 8. /b0ect Group 9Form Builder: 5n ob0ect group is a container for a group of ob0ects. 6ou define an ob0ect group ,"en you ,ant to pac2age related ob0ects so you can copy or subclass t"em in anot"er module. OBJECTS OF FORMS !.Bloc2s Bloc2 is logical o,ner of items. It provides a mec"anism for grouping related items into a functional unit for storing+ displaying and manipulating records. (.Items T"ese are interface ob0ects t"at present data values to t"e user or enable t"e user to interact ,it" t"e form. -. )anvas 5 canvas is t"e bac2ground ob0ect upon ,"ic" interface items appear. 3. Frames Frames are used to arrange items ,it" in a bloc2. 8. ;indo,s ;indo,s contains for all visual ob0ects t"at ma2e up a form builder application. <. #$%&'$ )ode Bloc2 It is used for event driven code. T"at code automatically executes ,"en a specific event occurs. Form Built - ins !.)$ 5.=F/.M )auses Form Builder to remove all records from+ or flus"+ t"e current form+ and puts t"e input focus in t"e first item of t"e first bloc2. (.)/MMIT=F/.M )auses Form Builder to update data in t"e database to matc" data in t"e form. Form Builder first validates t"e form+ t"en+ for eac" bloc2 in t"e form+ deletes+ inserts+ and updates to t"e database+ and performs a database commit. 5s a result of t"e database commit+ t"e database releases all ro, and table loc2s. -.D BUG=M/D Toggles debug mode on and off in a menu. ;"en debug mode is on in a menu+ Form Builder issues an appropriate message ,"en a menu item command executes. 3. 1T . >alidates data in t"e current validation unit. 9T"e default validation unit is Item.:

8. .5& .emoves an indicated global variable+ so t"at it no longer exists+ and releases t"e memory associated ,it" t"e global variable. Global al,ays allocate (88 bytes of storage. To ensure

Shik Mahamood Ali 3 t"at performance is not impacted more t"an necessary+ al,ays erase any global variable ,"en it is no longer needs <. X )UT =T.IGG . X )UT =T.IGG . executes an indicated trigger. ?. XIT=F/.M #rovides a means to exit a form+ confirming commits and specifying rollbac2 action. @.FI1D=F/.M &earc"es t"e list of forms and returns a form module ID ,"en it finds a valid form ,it" t"e given name. 6ou must define an appropriately typed variable to accept t"e return value. Define t"e variable ,it" a type of Form module. A. F/.M=F5I$U. .eturns a value t"at indicates t"e outcome of t"e action most recently performed during t"e current .unform session. Use F/.M=F5I$U. to test t"e outcome of a builtBin to determine furt"er processing ,it"in any trigger. To get t"e correct results+ you must perform t"e test immediately after t"e action executes. T"at is+ anot"er action s"ould not occur prior to t"e test. Exampl ! %C CC BuiltBin4 F/.M=F5I$U. CC xample4 Determine if t"e most recently executed builtBin CC failed. C% B GI1 G/=B$/)D9E&uccess=FactorE:F %C CC If some validation failed and prevented us from leaving CC t"e current bloc2+ t"en stop executing t"is trigger. CC CC Generally it is recommended to test CC IF 1/T Form=&uccess TG 1 ... CC .at"er t"an explicitly testing for F/.M=F5I$U. C% IF Form=Failure TG 1 .5I& Form=Trigger=FailureF 1D IFF 1DF FORM"F#T#L .eturns t"e outcome of t"e action most recently performed during t"e current .unform session.

Use F/.M=F5T5$ to test t"e outcome of a builtBin to determine furt"er processing ,it"in any trigger. To get t"e correct results+ you must perform t"e test immediately after t"e action executes. T"at is+ anot"er action s"ould not occur prior to t"e test. Exampl ! %C CC BuiltBin4 F/.M=F5T5$

Shik Mahamood Ali 4 CC xample4 )"ec2 ,"et"er t"e mostBrecently executed builtBin "ad a fatal error.C% B GI1 User= xit9E)alculate=$ine=Integral control.start control.stopE:F %C CC If t"e user exit code returned a fatal error+ print a CC message and stop executing t"is trigger. CC CC Generally it is recommended to test CC CC IF 1/T F/.M=&U)) && TG 1 ... CC CC .at"er t"an explicitly testing for F/.M=F5T5$ IF Form=Fatal TG 1 Message9E)annot calculate t"e $ine Integral due to internal error.E:F .5I& Form=Trigger=FailureF 1D IFF

1DF

FORM"SUCCESS .eturns t"e outcome of t"e action most recently performed during t"e current .unform session. Use F/.M=&U)) && to test t"e outcome of a builtBin to determine furt"er processing ,it"in any trigger. To get t"e correct results+ you must perform t"e test immediately after t"e action executes. T"at is+ anot"er action s"ould not occur prior to t"e test. Not ! F/.M=&U)) && s"ould not be used to test ,"et"er a )/MMIT=F/.M or #/&T builtBin "as succeeded. Because )/MMIT=F/.M may cause many ot"er triggers to fire+ ,"en you evaluate F/.M=&U)) && it may not reflect t"e status of )/MMIT=F/.M but of some ot"er+ more recently executed builtBin. 5 more accurate tec"ni*ue is to c"ec2 t"at t"e &6&T M.F/.M=&T5TU& variable is set to E'U .6E after t"e operation is done. Exampl ! %C CC BuiltBin4 F/.M=&U)) && CC xample4 )"ec2 ,"et"er t"e mostBrecently executed builtBin CC succeeded. B GI1 %C CC Force validation to occurC% nterF %C CC If t"e validation succeeded+ t"en )ommit t"e data. CC C% IF Form=&uccess TG 1 )ommitF IF 4&ystem.Form=&tatus HI E'U .6E TG 1 Message9E rror prevented )ommitE:F .5I& Form=Trigger=FailureF 1D IFF 1D IFF 1DF FORMS"DDL F/.M&=DD$9 statement:F Issues dynamic &'$ statements at runtime+ including serverBside #$%&'$ and DD$.

Shik Mahamood Ali 5 Not ! 5ll DD$ operations issue an implicit )/MMIT and ,ill end t"e current transaction ,it"out allo,ing /racle Forms to process any pending c"anges. If you If you use F/.M&=DD$ to execute a valid #$%&'$ bloc24 Use semicolons ,"ere appropriate. nclose t"e #$%&'$ bloc2 in a valid B GI1% 1D bloc2 structure. Do not end t"e #$%&'$ bloc2 ,it" a slas". $ine brea2s+ ,"ile permitted+ are not re*uired. use F/.M&=DD$ to execute a single DM$ or DD$ statement4 Exampl $! %C CC BuiltBin4 F/.M&=DD$ CC xample4 T"e expression can be a string literal.C% B GI1 Forms=DD$9Ecreate table temp9n 1UMB .:E:F IF 1/T Form=&uccess TG 1 Message 9ETable )reation FailedE:F $& Message 9ETable )reatedE:F 1D IFF 1DF Exampl %!

%C CC BuiltBin4 F/.M&=DD$ CC xample4 T"e string can be an expression or variable. CC )reate a table ,it" n 1umber columns. CC T M#9)/$!+ )/$(+ ...+ )/$n:. C% #./) DU. )reate=1=)olumn=1umber=Table 9n 1UMB .: I& my=stmt >5.)G5.(9(JJJ:F B GI1 my=stmt 4K Ecreate table tmp9)/$! 1UMB .EF F/. I in (..1 $//# my=stmt 4K my=stmtLLE+)/$ELLT/=)G5.9i:LLE 1UMB .EF 1D $//#F my=stmt 4K my=stmtLLE:EF %C CC 1o,+ create t"e table... C% Forms=DD$9my=stmt:F IF 1/T Form=&uccess TG 1 Message 9ETable )reation FailedE:F $& Message 9ETable )reatedE:F 1D IFF 1DF Exampl &!

%C CC BuiltBin4 F/.M&=DD$ CC xample4 T"e statement parameter can be a bloc2 CC of dynamically created #$%&'$ code. C% D )$5. procname >5.)G5.(9-J:F B GI1

Shik Mahamood Ali 6 IF 4global.flag K ET.U E TG 1 procname 4K E5ssign=1e,= mployerEF $& procname 4K EUpdate=1e,= mployerEF 1D IFF Forms=DD$9EBegin ELL procname LLEF ndFE:F IF 1/T Form=&uccess TG 1 Message 9E mployee Maintenance FailedE:F $& Message 9E mployee Maintenance &uccessfulE:F 1D IFF

1DF Exampl '!

%C CC BuiltBin4 F/.M&=DD$ CC xample4 Issue t"e &'$ statement passed in as an argument+ CC and return a number representing t"e outcome of CC executing t"e &'$ statement. CC 5 result of 7ero represents success. C% FU1)TI/1 Do=&*l 9stmt >5.)G5.(+ c"ec2=for=loc2s B//$ 51 4K T.U : . TU.1 1UMB . I& &'$=&U)) && )/1&T51T 1UMB . 4K JF B GI1 IF stmt I& 1U$$ TG 1 Message 9ED/=&'$4 #assed a null statement.E:F . TU.1 &'$=&U)) &&F 1D IF F IF )"ec2=For=$oc2s 51D 4&ystem.Form=&tatus K E)G51G DE TG 1 Message 9ED/=&'$4 Form "as outstanding loc2s pending.E:F . TU.1 &'$=&U)) &&F 1D IFF Forms=DD$9stmt:F IF Form=&uccess TG 1 . TU.1 &'$=&U)) &&F $& . TU.1 Dbms= rror=)odeF 1D IFF

1DF

G T=F/.M=#./# .T6 .eturns information about t"e given form. If your application is a multiMform application+ t"en you can call t"is builtMin to return information about t"e calling form+ as ,ell as about t"e current+ or called form. ID=1U$$ .eturns a B//$ 51 value t"at indicates ,"et"er t"e ob0ect ID is available. NE("FORM

Shik Mahamood Ali 7 xits t"e current form and enters t"e indicated form. T"e calling form is terminated as t"e parent form. If t"e calling form "ad been called by a "ig"er form+ /racle Forms 2eeps t"e "ig"er call active and treats it as a call to t"e ne, form. /racle Forms releases memory 9suc" as database cursors: t"at t"e terminated form ,as using. /racle Forms runs t"e ne, form ,it" t"e same .unform options as t"e parent form. If t"e parent form ,as a called form+ /racle Forms runs t"e ne, form ,it" t"e same options as t"e parent form. 1 ;=F/.M 9formmodule=name >5.)G5.(+ rollbac2=mode+*uery=mode+data=mode+paramlist=name : formmodule_name &pecifies t"e formmodule name of t"e called form. T"e name must be enclosed in single *uotes. T"e data type of t"e name is )G5.. rollback_mode TO"S#)EPOINT /racle Forms rolls bac2 all uncommitted c"anges 9including posted c"anges: to t"e current formEs savepoint. NO"ROLLB#C* /racle Forms exits t"e current form ,it"out rolling bac2 to a savepoint. 6ou can leave t"e top level form ,it"out performing a rollbac2+ ,"ic" means t"at you retain any loc2s across a 1 ;=F/.M operation. T"ese loc2s can also occur ,"en invo2ing /racle Forms from an external -G$ program. T"e loc2s are still in effect ,"en you regain control from /racle Forms. FULL"ROLLB#C* /racle Forms rolls bac2 all uncommitted c"anges 9including posted c"anges: t"at ,ere made during t"e current .unform session. 6ou cannot specify a FU$$=./$$B5)D from a form t"at is running in postBonly mode. 9#ostBonly mode can occur ,"en your form issues a call to anot"er form ,"ile unposted records exist in t"e calling form. To avoid losing t"e loc2s issued by t"e calling form+ /racle Forms prevents any commit processing in t"e called form.: query_mode Ta2es one of t"e follo,ing constants as an argument4 NO"+UERY"ONLY .uns t"e indicated form normally+ allo,ing t"e operator to perform inserts+ updates+ and deletes in t"e form. +UERY"ONLY .uns t"e indicated form as a *ueryBonly form.

paramlist_id &pecifies t"e uni*ue ID /racle Forms assigns ,"en it creates t"e parameter list. &pecify a parameter list ,"en you ,ant to pass parameters from t"e calling form to t"e ne, form. T"e data type of t"e ID is #5.5M$I&T. 5 parameter list passed to a form via 1 ;=F/.M cannot contain parameters of type D5T5=#5.5M T . 9a pointer to record group:. paramlist_name

Shik Mahamood Ali 8 T"e name you gave t"e parameter list ob0ect ,"en you defined it. T"e data type of t"e name is )G5.. 5 parameter list passed to a form via 1 ;=F/.M cannot contain parameters of type D5T5=#5.5M T . 9a pointer to record group:. C#LL"FORM, .uns an indicated form ,"ile 2eeping t"e parent form active. /racle Forms runs t"e called form ,it" t"e same .unform preferences as t"e parent form. ;"en t"e called form is exited /racle Forms processing resumes in t"e calling form at t"e point from ,"ic" you initiated t"e call to )5$$=F/.M. )5$$=F/.M 9formmodule=name >5.)G5.(+ display 1UMB .+ s,itc"=menu 1UMB .+ *uery=mode 1UMB .+ data=mode 1UMB .+ paramlist=name >5.)G5.(:F Param t rs! formmodule_name &pecifies t"e formmodule name of t"e called form. T"e name must be enclosed in single *uotes. T"e data type of t"e name is )G5.. display &pecify one of t"e follo,ing constants as an argument4 -IDE )auses /racle Forms to clear t"e calling form from t"e screen before dra,ing t"e called form. GID is t"e default parameter. NO"-IDE )auses /racle Forms to display t"e called form ,it"out clearing t"e calling form from t"e screen. switch_menu Ta2es one of t"e follo,ing constants as an argument4 NO"REPL#CE )auses /racle Forms to 2eep t"e default menu application of t"e calling form active for t"e called form. DO"REPL#CE )auses /racle Forms to replace t"e default menu application of t"e calling form ,it" t"e default menu application of t"e called form.

query_mode Ta2es one of t"e follo,ing constants as an argument4 NO"+UERY"ONLY )auses /racle Forms to run t"e indicated form in normal mode+ allo,ing t"e operator to perform inserts+ updates+ and deletes from ,it"in t"e called form. +UERY"ONLY )auses /racle Forms to run t"e indicated form in 'uery /nly mode+ allo,ing t"e operator to *uery+ but not to insert+ update+ or delete records. paramlist_id

Shik Mahamood Ali 9 &pecifies t"e uni*ue ID /racle Forms assigns ,"en it creates t"e parameter list. 6ou can optionally include a parameter list as initial input to t"e called form. T"e data type of t"e ID is #5.5M$I&T. paramlist_name T"e name you gave t"e parameter list ob0ect ,"en you defined it. T"e data type of t"e name is )G5.. )all=Form9Eloo2custE+1/=GID +D/=. #$5) +'U .6=/1$6:F OPEN"FORM /pens t"e indicated form. )all /# 1=F/.M to create multipleBform applications+ t"at is+ applications t"at open more t"an one form at t"e same time. /# 1=F/.M 9form=name >5.)G5.(+ activate=mode 1UMB .+ session=mode 1UMB .+ data=mode 1UMB .+ paramlist=id #5.5M$I&T:F form_name &pecifies t"e )G5. name of t"e form to open. activate_mode #CTI)#TE &ets focus to t"e form to ma2e it t"e active form in t"e application. NO"#CTI)#TE /pens t"e form but does not set focus to t"e form. T"e current form remains current. session_mode NO"SESSION &pecifies t"at t"e opened form s"ould s"are t"e same database session as t"e current form. 5 )/MMIT operation in any form ,ill cause validation and commit processing to occur for all forms running in t"e same session. SESSION &pecifies t"at a ne,+ separate database session s"ould be created for t"e opened form. paramlist_name &pecifies t"e )G5. name of a parameter list to be passed to t"e opened form.

paramlist_id &pecifies t"e uni*ue ID t"at /racle Forms assigns to t"e parameter list at t"e time it is created. Use t"e G T=#5.5M T .=$I&T function to return t"e ID to a variable of type #5.5M$I&T. /# /# /# /# /# 1=F/.M9 1=F/.M9 1=F/.M9 1=F/.M9 1=F/.M9 form=name:F form=name+activate=mode:F form=name+activate=mode+session=mode:F form=name+activate=mode+session=mode+paramlist=name:F form=name+activate=mode+session=mode+paramlist=id:F

REPL#CE"MENU

Shik Mahamood Ali

10

.eplaces t"e current menu ,it" t"e specified menu+ but does not ma2e t"e ne, menu active. . #$5) =M 1U also allo,s you to c"ange t"e ,ay t"e menu displays and t"e role. SET"FORM"PROPERTY &ets a property of t"e given form. S.ntax! & T=F/.M=#./# .T69 formmodule=id+ property+ value:F & T=F/.M=#./# .T69 formmodule=name+ property+ value:F D s/ription! T"e G T=5##$I)5TI/1=#./# .T6 builtBin returns information about t"e current /racle Forms application. 6ou must call t"is builtBin once for eac" value you ,ant to retrieve. tm=name 4K Get=5pplication=#roperty9TIM .=15M :F Exampl %! %C CC BuiltBin4 G T=5##$I)5TI/1=#./# .T6 CC xample4 )apture t"e username and pass,ord of t"e CC currently loggedBon user+ for use in calling CC anot"er Tool. C% #./) DU. Get=)onnect=Info9 t"e=username I1 /UT >5.)G5.(+ t"e=pass,ord I1 /UT >5.)G5.(+ t"e=connect I1 /UT >5.)G5.(: I& B GI1 t"e=username 4K Get=5pplication=#roperty9U& .15M :F t"e=pass,ord 4K Get=5pplication=#roperty9#5&&;/.D:F t"e=connect 4K Get=5pplication=#roperty9)/11 )T=&T.I1G:F 1DF Form- S.st m )aria0l s !.&6&T M.)U.. 1T=F/.M &6&T M.)U.. 1T=F/.M represents t"e name of t"e form t"at Form Builder is executing. T"e value is al,ays a c"aracter string. #./) DU. &T/. =F/.M15M I& B GI1 4G$/B5$.)alling=Form 4K 4&ystem.)urrent=FormF 1DF (. &6&T M.F/.M=&T5TU& &6&T M.F/.M=&T5TU& represents t"e status of t"e current form. T"e value can be one of t"ree c"aracter strings4 )G51G D Indicates t"at t"e form contains at least one bloc2 ,it" a )"anged record. T"e value of &6&T M.F/.M=&T5TU& becomes )G51G D only after at least one record in t"e form "as been c"anged and t"e associated navigation unit "as also c"anged. Indicates t"at t"e form contains only 1e, records. Indicates t"at a *uery is open. T"e form contains at least one bloc2 ,it" 'U .6 records and no bloc2s ,it" )G51G D records.

1 ; 'U .6

IF 4&ystem.Form=&tatus K E)G51G DETG 1 )ommit=FormF

Shik Mahamood Ali 1D IFF )lear=FormF -. &6&T M. M/D

11

&6&T M.M/D indicates ,"et"er t"e form is in 1ormal+ mode. T"e value is al,ays a c"aracter string.

nter 'uery+ or Fetc" #rocessing

1/.M5$ Indicates t"at t"e form is currently in normal processing mode. 1T .M'U .6Indicates t"at t"e form is currently in nter 'uery mode. 'U .6 Indicates t"at t"e form is currently in fetc" processing mode+ meaning t"at a *uery is currently being processed. Exampl ! 5ssume t"at you ,ant /racle Forms to display an $/> ,"en t"e operator enters *uery mode and t"e input focus is in a particular text item. T"e follo,ing trigger accomplis"es t"at operation. %C CC ;"enB1e,BItemBInstance Trigger C% B GI1 IF 4&ystem.)ursor=Item K E M#. M#1/E and 4&ystem.Mode K E 1T .B'U .6E TG 1 IF 1/T &"o,=$ov9Emy=lovE: TG 1 .5I& Form=Trigger=FailureF 1D IFF nd ifF 1DF BLOC*S Bloc2 is logical o,ner of items. It provides a mec"anism for grouping related items into a functional unit for storing+ displaying and manipulating records. Types of Bloc2s 1. Data Blocks Data bloc2s are associated ,it" data 9table columns: ,it"in a database. By default+ t"e association bet,een a data bloc2 and t"e database allo,s operators to automatically *uery+ update+ insert+ and delete ro,s ,it"in a database. Data bloc2s can be based on database tables+ vie,s+ procedures+ or transactional triggers. 2. Control Blocks 5 control bloc2 is not associated ,it" t"e database+ and t"e items in a control bloc2 do not relate to table columns ,it"in a database. 5ll bloc2s are eit"er singleMrecord or multiMrecord bloc2s4 5 singleMrecord bloc2 displays one record at a time. 5 multiMrecord bloc2 displays more t"an one record at a time. In addition+ a data bloc2 can also be a master or detail bloc24 Master bloc2 displays a master record associated ,it" detail records displayed in a detail bloc2. 5 detail bloc2 displays detail records associated ,it" a master record displayed in master bloc2.

Shik Mahamood Ali Block Built - ins !. B$/)D=M 1U builtMin

12

Displays a list of values 9$/>: containing t"e se*uence number and names of valid bloc2s in your form. Form Builder sets t"e input focus to t"e first enterable item in t"e bloc2 you select from t"e $/>. Exampl ! %C CC BuiltBin4 B$/)D=M 1U CC xample4 )alls up t"e list of bloc2s in t"e form ,"en t"e CC user clic2s a button+ and prints a message if CC t"e user c"ooses a ne, bloc2 out of t"e list to CC ,"ic" to navigate. C% D )$5. prev=bl2 >5.)G5.(93J: 4K 4&ystem.)ursor=Bloc2F B GI1 B$/)D=M 1UF IF 4&ystem.)ursor=Bloc2 HI prev=bl2 TG 1 Message9E6ou successfully navigated to a ne, bloc2NE:F 1D IFF 1DF (. )$ 5.=B$/)D builtMin )auses Form Builder to remove all records from+ or Oflus"+O t"e current bloc2. )lear=Bloc291o=>alidate:F COMMIT_MODE T"e optional action parameter ta2es t"e follo,ing possible constants as arguments4 5&D=)/MMIT Form Builder prompts t"e end user to commit t"e c"anges during )$ 5.=B$/)D processing. D/=)/MMIT Form Builder validates t"e c"anges+ performs a commit+ and flus"es t"e current bloc2 ,it"out prompting t"e end user. 1/=)/MMIT Form Builder validates t"e c"anges and flus"es t"e current bloc2 ,it"out performing a commit or prompting t"e end user. 1/=>5$ID5T Form Builder flus"es t"e current bloc2 ,it"out validating t"e c"anges+ committing t"e c"anges+ or prompting t"e end user. -. FI1D=B$/)D &earc"es t"e list of valid bloc2s and returns a uni*ue bloc2 ID. 6ou must define an appropriately typed variable to accept t"e return value. Define t"e variable ,it" a type of Bloc2. 3. G T=B$/)D=#./# .T6 .eturns information about a specified bloc2. 6ou must issue a call to t"e builtMin once for eac" property value you ,ant to retrieve. S.ntax! G T=B$/)D=#./# .T69 bloc2=id+ property:F G T=B$/)D=#./# .T69 bloc2=name+ property:F

Shik Mahamood Ali

13

CC Determine t"e 9!: )urrent .ecord t"e cursor is in+ CC 9(: )urrent .ecord ,"ic" is visible at t"e CC first 9top: line of t"e multirecord CC bloc2. C% cur=rec 4K Get=Bloc2=#roperty9 b2=id+ )U.. 1T=. )/.D:F top=rec 4K Get=Bloc2=#roperty9 b2=id+ T/#=. )/.D:F 8. G/=B$/)D G/=B$/)D navigates to an indicated bloc2. If t"e target bloc2 is nonMenterable + an error occurs. <. ID=1U$$ .eturns a B//$ 51 value t"at indicates ,"et"er t"e ob0ect ID is available. ?. 1 XT=B$/)D 1avigates to t"e first navigable item in t"e next enterable bloc2 in t"e navigation se*uence @.#. >I/U&=B$/)D 1avigates to t"e first navigable item in t"e previous enterable bloc2 in t"e navigation se*uence A.& T=B$/)D=#./# .T6 &ets t"e given bloc2 c"aracteristic of t"e given bloc2. S.ntax! & T=B$/)D=#./# .T69 bloc2=id+ property+ value:F & T=B$/)D=#./# .T69 bloc2=name+ property+ value:F

Exampl ! %C CC BuiltBin4 & T=B$/)D=#./# .T6 CC xample4 #revent future inserts+ updates+ and deletes to CC *ueried records in t"e bloc2 ,"ose name is CC passed as an argument to t"is procedure. C% #./) DU. Ma2e=Bloc2='uery=/nly9 bl2=name I1 >5.)G5.( : I& bl2=id Bloc2F B GI1 %C $oo2up t"e bloc2Es internal ID C% bl2=id 4K Find=Bloc29bl2=name:F %C CC If t"e bloc2 exists 9ie t"e ID is 1ot 1U$$: t"en set CC t"e t"ree properties for t"is bloc2. /t"er,ise signal CC an error. C% IF 1/T Id=1ull9bl2=id: TG 1 &et=Bloc2=#roperty9bl2=id+I1& .T=5$$/; D+#./# .T6=F5$& :F &et=Bloc2=#roperty9bl2=id+U#D5T =5$$/; D+#./# .T6=F5$& :F &et=Bloc2=#roperty9bl2=id+D $ T =5$$/; D+#./# .T6=F5$& :F $&

Shik Mahamood Ali 14 Message9EBloc2 ELLbl2=nameLLE does not exist.E:F .5I& Form=Trigger=FailureF 1D IFF 1DF Block ystem !ariables

!.&6&T M.B$/)D=&T5TU& &6&T M.B$/)D=&T5TU& represents t"e status of a Data bloc2 ,"ere t"e cursor is located+ or t"e current data bloc2 during trigger processing. T"e value can be one of t"ree c"aracter strings4 )G51G D 1 ; 'U .6 Indicates t"at t"e bloc2 contains at least one )"anged record. Indicates t"at t"e bloc2 contains only 1e, records. Indicates t"at t"e bloc2 contains only >alid records t"at "ave been retrieved from t"e database.

Exampl ! 5ssume t"at you ,ant to create a trigger t"at performs a commit before clearing a bloc2 if t"ere are c"anges to commit ,it"in t"at bloc2. T"e follo,ing DeyB)$.B$D trigger performs t"is function. IF 4&ystem.Bloc2=&tatus K E)G51G DE TG 1 )ommit=FormF 1D IFF )lear=Bloc2F

(.&6&T M.)U.. 1T=B$/)D T"e value t"at t"e &6&T M.)U.. 1T=B$/)D system variable represents depends on t"e current navigation unit4 If t"e current navigation unit is t"e bloc2+ record+ or item 9as in t"e #reM and #ostM Item+ .ecord+ and Bloc2 triggers:+ t"e value of &6&T M.)U.. 1T=B$/)D is t"e name of t"e bloc2 t"at Form Builder is processing or t"at t"e cursor is in. If t"e current navigation unit is t"e form 9as in t"e #reM and #ostMForm triggers:+ t"e value of &6&T M.)U.. 1T=B$/)D is 1U$$. -.&6&T M.)U.&/.=B$/)D T"e value t"at t"e &6&T M.)U.&/.=B$/)D system variable represents depends on t"e current navigation unit4 If t"e current navigation unit is t"e bloc2+ record+ or item 9as in t"e #reM and #ostM Item+ .ecord+ and Bloc2 triggers:+ t"e value of &6&T M.)U.&/.=B$/)D is t"e name of t"e bloc2 ,"ere t"e cursor is located. T"e value is al,ays a c"aracter string. If t"e current navigation unit is t"e form 9as in t"e #reM and #ostMForm triggers:+ t"e value of &6&T M.)U.&/.=B$/)D is 1U$$.

Shik Mahamood Ali Exampl !

15

5ssume t"at you ,ant to create a DeyB1XTB$D trigger at t"e form level t"at navigates depending on ,"at t"e current bloc2 is. T"e follo,ing trigger performs t"is function+ using 4&6&T M.)U.&/.=B$/)D stored in a local variable. D )$5. curbl2 >5.)G5.(9-J:F B GI1 curbl2 4K 4&ystem.)ursor=Bloc2F IF curbl2 K E/.D .&E TG 1 Go=Bloc29EIT M&E:F $&IF curbl2 K EIT M&E TG 1 Go=Bloc29E)U&T/M .&E:F $&IF curbl2 K E)U&T/M .&E TG 1 Go=Bloc29E/.D .&E:F 1D IFF 1DF 3. &6&T M.M5&T .=B$/)D T"is system variable ,or2s ,it" its companion &6&T M.)//.DI15TI/1=/# .5TI/1 to "elp an /nM)learMDetails trigger determine ,"at type of coordinationMcausing operation fired t"e trigger+ and on ,"ic" master bloc2 of a master%detail relation. 8. &6&T M.T.IGG .=B$/)D &6&T M.T.IGG .=B$/)D represents t"e name of t"e bloc2 ,"ere t"e cursor ,as located ,"en t"e current trigger initially fired. T"e value is 1U$$ if t"e current trigger is a #reM or #ostMForm trigger. T"e value is al,ays a c"aracter string.

Exampl ! 5ssume t"at you ,ant to ,rite a formBlevel procedure t"at navigates to t"e bloc2 ,"ere t"e cursor ,as ,"en t"e current trigger initially fired. T"e follo,ing statement performs t"is function. Go=Bloc291ame=In9E&ystem.Trigger=Bloc2E::F Block " Based #ri$$ers %Block &rocessin$ #ri$$er' ;"enM)reateM.ecord+ ;"enM)learMBloc2+ ;"enMDatabaseM.ecord+ ;"enM.emoveM.ecord M#STER-DET#IL REL#TIONS-IP 5 masterMdetail relations"ip is an association bet,een t,o data bloc2s t"at reflects a primaryM foreign 2ey relations"ip bet,een t"e database tables on ,"ic" t"e t,o data bloc2s are based. T"e master data bloc2 is based on t"e table ,it" t"e primary 2ey+ and t"e detail data bloc2 is based on t"e table ,it" t"e foreign 2ey. 5 masterMdetail relations"ip e*uates to t"e oneMtoM many relations"ip in t"e entity relations"ip diagram. 5 Detail Bloc2 )an Be a Master 6ou can create bloc2 relations"ips in ,"ic" t"e detail of one masterMdetail lin2 is t"e master for anot"er lin2. ;"at Is a .elationP

Shik Mahamood Ali 16 5 relation is a Form Builder ob0ect t"at "andles t"e relations"ip bet,een t,o associated bloc2s. 6ou can create a relation eit"er4 Q Implicitly ,it" a masterMdetail form module Q xplicitly in t"e /b0ect 1avigator Implicit .elations ;"en you create a masterMdetail form module+ a relation is automatically created. T"is relation is named masterbloc2=detailbloc2+ for example+ &=/.D=&=IT M. xplicit .elations If a relation is not establis"ed ,"en default bloc2s are created+ you can create your o,n by setting t"e properties in t"e 1e, .elation dialog box. $i2e implicitly created relations+ #$%&'$ program units and triggers are created automatically ,"en you explicitly create a relation. Master Deletes 6ou can prevent+ propagate+ or isolate deletion of a record in a master bloc2 ,"en corresponding records exist in t"e detail bloc2 by setting t"e Master Deletes property. For example+ you can delete all corresponding line items ,"en an order is deleted. #roperty Use 1onMIsolated )ascading Isolated #revents t"e deletion of t"e master record ,"en t"e detail records exist Deletes t"e detail records ,"en a master record is deleted Deletes only t"e master record

;"at Gappens ;"en 6ou Modify a .elationP Q Q )"anging t"e Master Deletes property from t"e default of 1onMIsolated to )ascading replaces t"e /nM)"ec2MDeleteMMaster trigger ,it" t"e #reM Delete trigger. )"anging t"e Master Deletes property from t"e default of 1onMIsolated to Isolated results in t"e removal of t"e /nM)"ec2MDeleteMMaster trigger.

MASTER DELETES
PROPERTY

RESULTING TRIGGERS

Non-Isolated (the defa lt!

"n-#he$k-%elete-Maste& "n-#lea&-%etails "n-'o( late-%etails

#as$adin)

"n-#lea&-%etails "n-'o( late-%etails '&e-%elete

Isolated

"n-#lea&-%etails "n-'o( late-%etails

Shik Mahamood Ali )oordination

17

6ou can control "o, t"e detail records are displayed ,"en a master bloc2 is *ueried by setting t"e coordination property. For example+ you can defer *uerying t"e line items for an order until t"e operator navigates to t"e item bloc2. Default RImmediateS T"e default setting. ;"en a coordinationMcausing event occurs+ t"e detail records are fetc"ed immediately. 9Deferred False+ 5utoM'uery False: Deferred ,it" 5uto 'uery /racle Forms defers fetc"ing t"e associated detail records until t"e operator navigates to t"e detail data bloc2. Deferred ;it"out 5uto 'uery ;"en coordinationMcausing event occurs+ /racle Forms does not automatically fetc" t"e detail records. To fetc" t"e detail records+ t"e operator must navigate to t"e detail data bloc2 and explicitly execute a *uery. #revent Masterless /peration nsures t"at t"e detail data bloc2 cannot be *ueried or used to insert records ,"en a master record is not currently displayed. Toin )ondition Use to4 Q Q Q Q Q )reate lin2s bet,een bloc2s using &'$ 5lter lin2s bet,een bloc2s using &'$ Define using4 Usual &'$ e*uiM0oin condition syntax Bloc2 names instead of t"e base table names Item names t"at exist in t"e form module instead of base table column names

MasterMdetail triggers On-Check-Delete-Master, On-Populate-Details, On-Clear-Details

RECORD 1ROUP T"is ob0ect represents an internal Form Builder data structure t"at "as a column%ro, frame,or2 similar to a database table. 'uery record group 5 *uery record group is a record group t"at "as an associated & $ )T statement. T"e columns in a *uery record group derive t"eir default names+ data types+ and lengt"s from t"e database columns referenced in t"e & $ )T statement. T"e records in a *uery record group are t"e ro,s retrieved by t"e *uery associated ,it" t"at record group. 'uery record groups can be created and modified at design time or at runtime. 1onM*uery record group 5 nonM*uery record group is a group t"at does not "ave an associated *uery+ but ,"ose structure and values can be modified programmatically at runtime. 1onM*uery record groups can be created and modified only at runtime. &tatic record group

Shik Mahamood Ali 18 5 static record group is not associated ,it" a *ueryF instead+ you define its structure and ro, values at design time+ and t"ey remain fixed at runtime. &tatic record groups can be created and modified only at design time. .ecord Group builtMin subprograms Creating and deleting groups: 5S ). 5T =G./U# 9recordgroup=name >5.)G5.(+ scope 1UMB .+ array=fetc"=si7e 1UMB .: )reates a nonM*uery record group ,it" t"e given name BS ). 5T =G./U#=F./M='U .6 9recordgroup=name >5.)G5.(+ *uery >5.)G5.(+ scope 1UMB .+ array=fetc"=si7e 1UMB .:F )reates a record group ,it" t"e given name. T"e record group "as columns representing eac" column you include in t"e select list of t"e *uery )S D $ T =G./U# 9recordgroup=name >5.)G5.(:F Deletes a programmatically created record group. Modifying a groupUs structure4 5DD=G./U#=)/$UM1 9recordgroup=name >5.)G5.(+ groupcolumn=name >5.)G5.(+column=type 1UMB .+ column=,idt" 1UMB .: 5dds a column of t"e specified type to t"e given record group. 5DD=G./U#=./; 9recordgroup=name >5.)G5.(+ ro,=number 5dds a ro, to t"e given record group. 1UMB .:F

D $ T =G./U#=./; 9recordgroup=id .ecordGroup+ ro,=number 1UMB .: Deletes t"e indicated ro, or all ro,s of t"e given record group. Form Builder automatically decrements t"e ro, numbers of all ro,s t"at follo, a deleted ro,. ;"en ro,s are deleted+ t"e appropriate memory is freed and available to Form Builder.

#opulating Groups4 #/#U$5T =G./U# 9recordgroup=id .ecordGroup:F xecutes t"e *uery associated ,it" t"e given record group and returns a number indicating success or failure of t"e *uery. Upon a successful *uery+ #/#U$5T =G./U# returns a J 97ero:. 5n unsuccessful *uery generates an /.5)$ error number t"at corresponds to t"e particular & $ )T statement failure. T"e ro,s t"at are retrieved as a result of a successful *uery replace any ro,s t"at exist in t"e group. #/#U$5T =G./U#=;ITG='U .6 9recordgroup=id .ecordGroup+ *uery >5.)G5.(: #opulates a record group ,it" t"e given *uery. T"e record group is cleared and ro,s t"at are fetc"ed replace any existing ro,s in t"e record group. & T=G./U#=)G5.=) $$9groupcolumn=id Group)olumn+ro,=number 1UMB .+cell=value >5.)G5.(: &ets t"e value for t"e record group cell identified by t"e given ro, and column. & T=G./U#=D5T =) $$ 9groupcolumn=id Group)olumn+ ro,=number 1UMB .+ cell=value D5T :F &ets t"e value for t"e record group cell identified by t"e given ro, and column.

Shik Mahamood Ali

19

& T=G./U#=1UMB .=) $$9groupcolumn=id Group)olumn+ ro,=number 1UMB .+cell=value 1UMB .:F &ets t"e value for t"e record group cell identified by t"e given ro, and column. Getting cell values4 G T=G./U#=)G5.=) $$ 9groupcolumn=id Group)olumn+ ro,=number 1UMB .:F

.eturns t"e >5.)G5.( or $/1G value for a record group cell identified by t"e given ro, and column. 5 cell is an intersection of a ro, and column. G T=G./U#=D5T =) $$ 9function: G T=G./U#=1UMB .=) $$ 9function: #rocessing ro,s4 G T=G./U#=./;=)/U1T 9function: G T=G./U#=& $ )TI/1=)/U1T 9function: G T=G./U#=& $ )TI/1 9function: . & T=G./U#=& $ )TI/1 9procedure: & T=G./U#=& $ )TI/1 9procedure: U1& T=G./U#=& $ )TI/1 9procedure: /b0ect ID functions4 FU1)TI/1 FI1D=G./U# 9recordgroup=name >5.)G5.(:F

&earc"es t"e list of record groups and returns a record group ID ,"en it finds a valid group ,it" t"e given name. 6ou must define an appropriately typed variable to accept t"e return value. Define t"e variable ,it" a type of .ecordGroup. FI1D=)/$UM1 9function: Exampl ! %C CC BuiltBin4 ). 5T =G./U# CC xample4 )reates a record group and populates its values CC from a *uery.C% D )$5. rg=name >5.)G5.(93J: 4K E&alary=.angeEF rg=id .ecordGroupF gc=id Group)olumnF errcode 1UMB .F B GI1 %C CC Ma2e sure t"e record group does not already exist. C% rg=id 4K Find=Group9rg=name:F %C CC If it does not exist+ create it and add t"e t,o CC necessary columns to it. C% IF Id=1ull9rg=id: TG 1 rg=id 4K )reate=Group9rg=name:F %C 5dd t,o number columns to t"e record group C% gc=id 4K 5dd=Group=)olumn9rg=id+ EBase=&al=.angeE+ 1UMB .=)/$UM1:F gc=id 4K 5dd=Group=)olumn9rg=id+ E mps=In=.angeE+ 1UMB .=)/$UM1:F 1D IFF %C CC #opulate group ,it" a *uery C%

Shik Mahamood Ali

1DF

20 errcode 4K #opulate=Group=;it"='uery9 rg=id+ E& $ )T &5$BM/D9&5$+!JJJ:+)/U1T9 M#1/: E LLEF./M M# E LLEG./U# B6 &5$BM/D9&5$+!JJJ: E LLE/.D . B6 !E:F

LO) 2 LIST OF )#LUES 3 5n $/> is a scrollable popup ,indo, t"at provides t"e end user ,it" eit"er a single or multiMcolumn selection list. Default Dey for LO) 4 F5 $/>s provide t"e follo,ing functionality4 $/>s can be displayed by end user re*uest 9,"en an $/> is available:+ ,"en t"e end user navigates to a text item ,it" an associated $/>+ or programmatically+ independent of any specific text item. $/> autoMreduction and searc" features allo, end users to locate specific values. $/> values t"at are selected by t"e end user can be assigned to form items according to t"e return items you designate. 5t design time+ an $/> can be attac"ed to one or more text items in t"e form. $/> values are derived from record groups.

$/> BuiltMin subprograms !.$I&T=>5$U & $I&T=>5$U & displays t"e list of values for t"e current item+ as long as t"e input focus is in a text item t"at "as an attac"ed $/>. T"e list of values remains displayed until t"e operator dismisses t"e $/> or selects a value. (.&G/;=$/> Displays a list of values 9$/>: ,indo, at t"e given coordinates+ and returns T.U if t"e operator selects a value from t"e list+ and F5$& if t"e operator )ancels and dismisses t"e list. &G/;=$/>9 lov=id:F &G/;=$/>9 lov=id+ x+ y:F &G/;=$/>9 lov=name:F &G/;=$/>9 lov=name+ x+ y:F Exampl ! %C CC BuiltBin4 &G/;=$/> CC xample4 Display a named $ist of >alues 9$/>: C% D )$5. a=value=c"osen B//$ 51F B GI1 a=value=c"osen 4K &"o,=$ov9Emy=employee=status=lovE:F IF 1/T a=value=c"osen TG 1 Message9E6ou "ave not selected a value.E:F BellF .5I& Form=Trigger=FailureF 1D IFF $/> #roperties !. G T=$/>=#./# .T6 9lov=id+ property $/>:F

Shik Mahamood Ali

21 .eturns information about a specified list of values 9$/>:. value 1UMB .:F

(. & T=$/>=#./# .T69lov=id $/>+ property 1UMB .+ &ets t"e given $/> property for t"e given $/>.

-.G./U#=15M &pecifies t"e name of t"e record group on ,"ic" an $/> is based. &et=$/>=#roperty9Umy=lovU+G./U#=15M +Une,=groupU:F 3. & T=$/>=)/$UM1=#./# .T6 &ets t"e given $/> property for t"e given $/>. & T=$/>=)/$UM1=#./# .T6 9lov=id 1UMB .+value >5.)G5.(:F $/>+colnum 1UMB .+ property

8. 5utomatic &2ip 9$/>: property Moves t"e cursor to t"e next navigable item ,"en t"e operator ma2es a selection from an $/> to a text item. ;"en 5utomatic &2ip is set to 1o+ t"e focus remains in t"e text item after t"e operator ma2es a selection from t"e $/>. <.)olumn Mapping T"is property is used to specify t"e return item.IIf it is not specified t"en value from $ov cannot assigned to t"e bloc2. ?. $ong $ist It is used to append a V ,"ere clause V to t"e select statement. ;"en t"is property is true a dialog box appear. In t"is dialog box any value can be entered+ from t"is value entered t"e ,"ere clause constructed. @. $/> for >alidation R 6es % 1o S If it is true so t"at t"e system c"ec2 value entered ,it" t"e list of values >alidation from $/> B text item property M >alidation from $ov to text item. A.Title property &pecifies t"e title to be displayed for t"e ob0ect. !J.5utomatic .efres" property Determines ,"et"er Form Builder reMexecutes t"e *uery to populate an $/> t"at is based on a *uery record group. !!.5utomatic Display property &pecifies ,"et"er Form Builder displays t"e $/> automatically ,"en t"e operator or t"e application navigates into a text item to ,"ic" t"e $/> is attac"ed. !(.5utomatic &elect property &pecifies ,"at "appens ,"en an $/> "as been invo2ed and t"e user reduces t"e list to a single c"oice ,"en using autoMreduction or searc"ing4 ;"en 5utomatic )onfirm is set to 6es+ t"e $/> is dismissed automatically and column values from t"e single ro, are assigned to t"eir corresponding return items. ;"en 5utomatic )onfirm is set to 1o+ t"e $/> remains displayed+ giving t"e operator t"e option to explicitly select t"e remaining c"oice or dismiss t"e $/>. DeyM$I&T>5$ Trigger4 $ist=>aluesF

Shik Mahamood Ali

22

T"is trigger+ as ,ritten+ is of little value since it merely duplicates default Form Builder functionality. Go,ever+ using a DeyM$I&T>5$ trigger allo,s you to add subse*uent #$%&'$ statements t"at execute after t"e $/> is displayed+ but before Form Builder returns to t"e normal event se*uence. In t"e follo,ing example+ an IF statement is added to t"e previous trigger4 DeyM$I&T>5$ Trigger4 $ist=>aluesF IF 4customer.id I& 1U$$ TG 1 Go=Item 9Ucustomer.idU:F 1D IFF P#R#METER LIST $ist of #arameter or list t"at contains parameter names and t"eir values Input values re*uired for a form as startup are provided by parameters. Types !. Data #arameter It is name of t"e record group present in t"e current form. It is passed bet,een oracle products. But not bet,een forms. (. Text #arameter It is passed bet,een forms. T"e value of t"e text parameter is a c"aracter string. It can also passed bet,een different oracle products. Data type B c"ar B (888 c"ar maximum Global variables are visible across multiple forms #arameter values are not visible across multiple forms. #arameter B Built Ins !. 5DD=#5.5M T . 9list >5.)G5.(+ 2ey >5.)G5.(+ paramtype >5.)G5.(+ >5.)G5.(:F 5dds parameters to a parameter list. ac" parameter consists of a 2ey+ its type+ and an associated value. (.). 5T =#5.5M T .=$I&T 9name >5.)G5.(:F )reates a parameter list ,it" t"e given name. -. D $ T =#5.5M T . 9list >5.)G5.(+ 2ey >5.)G5.(: Deletes t"e parameter ,it" t"e given 2ey from t"e parameter list. list or name &pecifies t"e parameter list+ eit"er by list ID or name. T"e actual parameter can be eit"er a parameter list ID of type #5.5M$I&T+ or t"e >5.)G5.( name of t"e parameter list. T"e name of t"e parameter. T"e data type of t"e 2ey is >5.)G5.(.

2ey

3.#./) DU. D &T./6=#5.5M T .=$I&T 9list >5.)G5.(: Deletes a dynamically created parameter list and all parameters it contains. 8. G T=#5.5M T .=5TT. 9list >5.)G5.(+ 2ey >5.)G5.(+ paramtype 1UMB .+value >5.)G5.(:F .eturns t"e current value and type of an indicated parameter in an indicated parameter list. list or name

Shik Mahamood Ali 23 &pecifies t"e parameter list to ,"ic" t"e parameter is assigned. T"e actual parameter can be eit"er a parameter list ID of type #5.5M$I&T+ or t"e >5.)G5.( name of t"e parameter list. Dey T"e >5.)G5.( name of t"e parameter. #aramtype 5n /UT parameter of type 1UMB .. T"e actual parameter you supply must be a variable of type 1UMB .+ and cannot be an expression. xecuting t"e parameter sets t"e value of t"e variable to one of t"e follo,ing numeric constants4 D5T5=#5.5M T . Indicates t"at t"e parameterUs value is t"e name of a record group. T XT=#5.5M T . Indicates t"at t"e parameterUs value is an actual data value. >alue 5n /UT parameter of type >5.)G5.(. If t"e parameter is a data type parameter+ t"e value is t"e name of a record group. If t"e parameter is a text parameter+ t"e value is an actual text parameter. <.& T=#5.5M T .=5TT. 9list #5.5M$I&T+ 2ey >5.)G5.(+ paramtype 1UMB .: &ets t"e type and value of an indicated parameter in an indicated parameter list. RUN"PRODUCT 0uilt-in Invo2es one of t"e supported /racle tools products and specifies t"e name of t"e module or module to be run. If t"e called product is unavailable at t"e time of t"e call+ Form Builder returns a message to t"e end user. S.ntax! .U1=#./DU)T9 product+ document+ commmode+ execmode+ location+list+ display:F .U1=#./DU)T9 product+ document+ commmode+ execmode+ location+name+ display:F product &pecifies a numeric constant for t"e /racle product you ,ant to invo2e4 F/.M& specifies a .unform session. G.5#GI)& specifies /racle Grap"ics. . #/.T& specifies /racle .eports. B//D specifies /racle Boo2. document &pecifies t"e )G5. name of t"e document or module to be executed by t"e called product. >alid values are t"e name of a form module+ report+ /racle Grap"ics display+ or /racle Boo2 document. T"e application loo2s for t"e module or document in t"e default pat"s defined for t"e called product. commmode &pecifies t"e communication mode to be used ,"en running t"e called product. >alid numeric constants for t"is parameter are &61)G./1/U& and 5&61)G./1/U&. SYNC-RONOUS specifies t"at control returns to /racle Forms only after t"e called product "as been exited. T"e operator cannot ,or2 in t"e form ,"ile t"e called product is running. #SYNC-RONOUS specifies t"at control returns to t"e calling application immediately+ even if t"e called application "as not completed its display. execmode

Shik Mahamood Ali 24 &pecifies t"e execution mode to be used ,"en running t"e called product. >alid numeric constants for t"is parameter are B5T)G and .U1TIM . ;"en you run /racle .eports and /racle Grap"ics+ execmode can be eit"er B5T)G or .U1TIM . ;"en you run /racle Forms+ al,ays set execmode to .U1TIM . location &pecifies t"e location of t"e document or module you ,ant t"e called product to execute+ eit"er t"e file system or t"e database. >alid constants for t"is property are FI$ &6&T M and DB. list or name &pecifies t"e parameter list to be passed to t"e called product. >alid values for t"is parameter are t"e )G5. name of t"e parameter list+ t"e ID of t"e parameter list+ or 1U$$. To specify a parameter list ID+ use a variable of type #5.5M$I&T.

displa &pecifies t"e )G5. name of t"e /racle Forms c"art item t"at ,ill contain t"e display 9suc" as a pie c"art+ bar c"art+ or grap": generated by /racle Grap"ics. T"e name of t"e c"art item must be specified in t"e format !lock_name"item_name. 9T"is parameter is only re*uired ,"en you are using an /racle Grap"ics c"art item in a form.: Not ! 6ou can pass text parameters to called products in bot" &61)G./1/U& and 5&61)G./1/U& mode. Go,ever+ parameter lists t"at contain parameters of type D5T5=#5.5M T . 9pointers to record groups: can only be passed to /racle .eports and /racle Grap"ics in &61)G./1/U& mode. 9&61)G./1/U& mode is re*uired ,"en invo2ing /racle Grap"ics to return an /racle Grap"ics display t"at ,ill be displayed in a form c"art item.: Not ! 6ou can prevent /racle Grap"ics from logging on by passing a parameter list t"at includes a parameter ,it" ke set to $/G/1 and #alue set to 1/. Not ! 6ou cannot pass a D5T5=#5.5M T . to a c"ild *uery in /racle .eports. Data passing is supported only for master *ueries. Exampl ! %C CC BuiltBin4 .U1=#./DU)T CC xample4 )all an /racle .eports (.8 report+ passing t"e CC data in record group E M#=. )&E to substitute CC for t"e reportEs *uery named E M#='U .6E. CC #resumes t"e mp=.ecs record group already CC exists and "as t"e same column%data type CC structure as t"e reportEs mp='uery *uery. C% #./) DU. .un= mp=.eport I& pl=id #aram$istF B GI1 %C CC )"ec2 to see if t"e EtmpdataE parameter list exists. C% pl=id 4K Get=#arameter=$ist9EtmpdataE:F %C CC If it does+ t"en delete it before ,e create it again in CC case it contains parameters t"at are not useful for our CC purposes "ere. C% IF 1/T Id=1ull9pl=id: TG 1 Destroy=#arameter=$ist9 pl=id :F

Shik Mahamood Ali 1D IFF

25

%C CC )reate t"e EtmpdataE parameter list afres". C% pl=id 4K )reate=#arameter=$ist9EtmpdataE:F %C CC 5dd a data parameter to t"is parameter list t"at ,ill CC establis" t"e relations"ip bet,een t"e named *uery CC E M#='U .6E in t"e report+ and t"e record group named CC E M#=. )&E in t"e form. C% 5dd=#arameter9pl=id+E M#='U .6E+D5T5=#5.5M T .+E M#=. )&E:F %C CC .un t"e report sync"ronously+ passing t"e parameter list C% .un=#roduct9. #/.T&+ EempreportE+ &61)G./1/U&+ .U1TIM +FI$ 6&T M+ pl=id+ 1U$$:F 1DF Exampl !
%C CC BuiltBin4 ). 5T =#5.5M T .=$I&T CC xample4 )reate a parameter list named ET M#D5T5E. First CC ma2e sure t"e list does not already exist+ t"en CC attempt to create a ne, list. &ignal an error CC if t"e list already exists or if creating t"e CC list fails. C% D )$5. B GI1

pl=id #aram$istF pl=name >5.)G5.(9!J: 4K EtempdataEF pl=id 4K Get=#arameter=$ist9pl=name:F IF Id=1ull9pl=id: TG 1 pl=id 4K )reate=#arameter=$ist9pl=name:F IF Id=1ull9pl=id: TG 1 Message9E rror creating parameter list ELLpl=name:F .5I& Form=Trigger=FailureF 1D IFF $& Message9E#arameter list ELLpl=nameLLE already existsNE:F .5I& Form=Trigger=FailureF 1D IFF

1DF

Exampl ! %C CC BuiltBin4 5DD=#5.5M T . CC xample4 5dd a value parameter to an existing #arameter CC $ist ET M#D5T5E+ t"en add a data parameter to CC t"e list to associate named *uery ED #T='U .6E CC ,it" record group ED #T=. )/.DG./U#E. C% D )$5. pl=id #aram$istF B GI1 pl=id 4K Get=#arameter=$ist9EtempdataE:F IF 1/T Id=1ull9pl=id: TG 1 5dd=#arameter9pl=id+Enumber=of=copiesE+T XT=#5.5M T .+E!AE:F 5dd=#arameter9pl=id+ Edept=*ueryE+ D5T5=#5.5M T .+ Edept=recordgroupE:F 1D IFF 1DF Exampl ! %C CC BuiltBin4 D $ T =#5.5M T . CC xample4 .emove t"e E1UMB .=/F=)/#I &E parameter from t"e CC already existing ET M#D5T5E parameter list. C% B GI1

Shik Mahamood Ali 26 Delete=#arameter9EtempdataE+Enumber=of=copiesE:F ndF Exampl ! %C CC BuiltBin4 D &T./6=#5.5M T .=$I&T CC xample4 .emove t"e parameter list EtempdataE after first CC c"ec2ing to see if it exists C% D )$5. pl=id #aram$istF B GI1 pl=id 4K Get=#arameter=$ist9EtempdataE:F IF 1/T Id=1ull9pl=id: TG 1 Destroy=#arameter=$ist9pl=id:F 1D IFF 1DF Exampl %!

#./) DU. .un=.eport=For=$ast='uery I& pl #aram$istF ,c >5.)G5.(9(JJJ:F BB T"e ;"ere )lause to #ass B GI1 %C CC )reate a parameter list for parameter passing C% pl 4K )reate=#arameter=$ist9EtmpE:F %C CC Get t"e ;"ere )lause from t"e $ast 'uery CC using a userBdefined function C% ,c 4K $ast=;"ere=)lauseF %C CC If t"ere is a 1onB1U$$ $ast ;"ere clause to CC pass+ add a text parameter to t"e parameter CC list to specify t"e parameter name and its CC value. In t"is case t"e report definition "as CC a parameter named Et"e=;"ere=)lauseE t"at CC itEs expecting. C% IF ,c I& 1/T 1U$$ TG 1 5dd=#arameter9pl+ Et"e=;"ere=)lauseE+ T XT=#5.5M T .+ ,c :F 1D IFF %C CC $aunc" t"e report+ passing parameters in t"e CC parameter list. C% .un=#roduct9. #/.T&+ BB T"e #roduct to call ErepJJ8@.rdfE+ BB T"e name of t"e report definition &61)G./1/U&+ BB T"e communications mode B5T)G+ BB T"e xecution Mode FI$ &6&T M+ BB T"e $ocation of t"e reports document pl :F BB T"e Gandle to t"e parameter list %C Delete t"e parameter list C% Destroy=#arameter=$ist9pl:F BB BB BB BB BB Gandle to t"e #aram$ist 1ame of #arameter in t"e .eport Type of #arameter &tring >alue for #arameter

1DF

R 6 r n/in7 Form Buil8 r it ms in8ir /tl. !.15M =I1

Shik Mahamood Ali 27 T"e 15M =I1 function returns t"e contents of an indicated variable or item. Use t"e 15M =I1 function to get t"e value of an item ,it"out referring to t"e item directly. IF 4emp.ename K Usmit"U MM direct reference IF 15M =I19Uemp.enameU: K Usmit"U MM indirect reference (.)/#6 builtMin )opies a value from one item or variable into anot"er item or global variable. )/#6915M =I19source:+ destination:F cur=val >5.)G5.(93J:F )opy9 cur=val+ U mp. mpnoU :F )#RI#BLES It is used to store values from form items. !.$ocal >ariables T"e local variable is #$%&'$ variable ,"ose value is only accessible ,it" in t"e trigger or user named sub #rograms (.Global >ariable ;"ose value is accessible to trigger and subprograms in any modules B limit B (88 c"ar lengt" -.&ystem >ariable It is used to trac2 of runtime status condition. Destroy global variable M &ystem >ariable !. &6&T M.B$/)D=&T5TU& &6&T M.B$/)D=&T5TU& represents t"e status of a Data bloc2 ,"ere t"e cursor is located+ or t"e current data bloc2 during trigger processing. T"e value can be one of t"ree c"aracter strings4 )G51G D 1 ; 'U .6 Indicates t"at t"e bloc2 contains at least one )"anged record. Indicates t"at t"e bloc2 contains only 1e, records. Indicates t"at t"e bloc2 contains only >alid records t"at "ave been retrieved from t"e database. erase9Vglobal.aE:F

(. &6&T M.)//.DI15TI/1=/# .5TI/1 T"is system variable ,or2s ,it" its companion &6&T M.M5&T .=B$/)D to "elp an /nM )learMDetails trigger determine ,"at type of coordinationMcausing operation fired t"e trigger+ and on ,"ic" master bloc2 of a master%detail relation. -.&6&T M.)U.. 1T=B$/)D s T"e value t"at t"e &6&T M.)U.. 1T=B$/)D system variable represents depends on t"e current navigation unit4 If t"e current navigation unit is t"e bloc2+ record+ or item 9as in t"e #reM and #ostM Item+ .ecord+ and Bloc2 triggers:+ t"e value of &6&T M.)U.. 1T=B$/)D is t"e name of t"e bloc2 t"at Form Builder is processing or t"at t"e cursor is in. If t"e current navigation unit is t"e form 9as in t"e #reM and #ostMForm triggers:+ t"e

Shik Mahamood Ali 28 value of &6&T M.)U.. 1T=B$/)D is 1U$$. 3. &6&T M.)U.. 1T=D5T TIM &6&T M.)U.. 1T=D5T TIM is a variable representing t"e operating system date. T"e value is a )G5. string in t"e follo,ing format4 DDMM/1M6666 GG(34MM4&&

8. &6&T M.)U.. 1T=F/.M &6&T M.)U.. 1T=F/.M represents t"e name of t"e form t"at Form Builder is executing. T"e value is al,ays a c"aracter string. <. &6&T M.)U.&/.=IT M &6&T M.)U.&/.=IT M represents t"e name of t"e bloc2 and item+ bloc2. item+ ,"ere t"e input focus 9cursor: is located. T"e value is al,ays a c"aracter string. ?. &6&T M.)U.&/.=. )/.D &6&T M.)U.&/.=. )/.D represents t"e number of t"e record ,"ere t"e cursor is located. T"is number represents t"e recordUs current p"ysical order in t"e bloc2Us list of records. T"e value is al,ays a c"aracter string. @. &6&T M.)U.&/.=>5$U &6&T M.)U.&/.=>5$U represents t"e value of t"e item ,"ere t"e cursor is located. T"e value is al,ays a c"aracter string. A. &6&T M.F/.M=&T5TU& &6&T M.F/.M=&T5TU& represents t"e status of t"e current form. T"e value can be one of t"ree c"aracter strings4 )G51G D Indicates t"at t"e form contains at least one bloc2 ,it" a )"anged record. T"e value of &6&T M.F/.M=&T5TU& becomes )G51G D only after at least one record in t"e form "as been c"anged and t"e associated navigation unit "as also c"anged. Indicates t"at t"e form contains only 1e, records. Indicates t"at a *uery is open. T"e form contains at least one bloc2 ,it" 'U .6 records and no bloc2s ,it" )G51G D records.

1 ; 'U .6

!J. &6&T M.$5&T='U .6 &6&T M.$5&T='U .6 represents t"e *uery & $ )T statement t"at Form Builder most recently used to populate a bloc2 during t"e current .unform session. T"e value is al,ays a c"aracter string. !!. &6&T M.M5&T .=B$/)D T"is system variable ,or2s ,it" its companion &6&T M.)//.DI15TI/1=/# .5TI/1 to "elp an /nM)learM Details trigger determine ,"at type of coordinationMcausing operation fired t"e trigger+ and on ,"ic" master bloc2 of a master%detail relation.

!(. &6&T M.M/D s &6&T M.M/D indicates ,"et"er t"e form is in 1ormal+ nter 'uery+ or Fetc" #rocessing mode. T"e value is al,ays a c"aracter string. 1/.M5$ Indicates t"at t"e form is currently in normal processing mode. 1T .M'U .6Indicates t"at t"e form is currently in nter 'uery mode.

Shik Mahamood Ali 'U .6

29 Indicates t"at t"e form is currently in fetc" processing mode+ meaning t"at a *uery is currently being processed.

!-. &6&T M.M/U& =IT M If t"e mouse is in an item+ &6&T M.M/U& =IT M represents t"e name of t"at item as a )G5. value. For example+ if t"e mouse is in Item! in Bloc2(+ t"e value for &6&T M.M/U& =IT M is 4B$/)D(.IT M!. &6&T M.M/U& =IT M is 1U$$ if4 t"e mouse is not in an item t"e operator presses t"e left mouse button+ t"en moves t"e mouse t"e platform is not a GUI platform.

!3. &6&T M.. )/.D=&T5TU& &6&T M.. )/.D=&T5TU& represents t"e status of t"e record ,"ere t"e cursor is located. T"e value can be one of four c"aracter strings4 )G51G D I1& .T 1 ; 'U .6 Indicates t"at a *ueried recordUs validation status is )"anged. Indicates t"at t"e recordUs validation status is )"anged and t"at t"e record does not exist in t"e database. Indicates t"at t"e recordUs validation status is 1e,. Indicates t"at t"e recordUs validation status is >alid and t"at it ,as retrieved from t"e database.

!8. &6&T M.T.IGG .=B$/)D &6&T M.T.IGG .=B$/)D represents t"e name of t"e bloc2 ,"ere t"e cursor ,as located ,"en t"e current trigger initially fired. T"e value is 1U$$ if t"e current trigger is a #reM or #ostMForm trigger. T"e value is al,ays a c"aracter string. !<. &6&T M.T.IGG .=IT M &6&T M.T.IGG .=IT M represents t"e item 9B$/)D.IT M: in t"e scope for ,"ic" t"e trigger is currently firing. ;"en referenced in a 2ey trigger+ it represents t"e item ,"ere t"e cursor ,as located ,"en t"e trigger began. T"e value is al,ays a c"aracter string. PROPERTY CL#SS T"is ob0ect is a named ob0ect t"at contains a list of properties and t"eir associated settings. /nce you create a property class you can base ot"er ob0ects on it. 5n ob0ect based on a property class can in"erit t"e settings of any property in t"e class t"at is appropriate for t"at ob0ect. T"e #roperty #alette is ,"ere you set t"e properties of ob0ects you create in form and menu modules. T"ere are ( ,ays to creating property class a. /b0ect 1avigator met"od. b. #roperty ;indo, met"od #roperty class can not be c"ange programmatically. )ISU#L #TTRIBUTES >isual attributes are t"e font+ color+ and pattern properties t"at you set for form and menu ob0ects t"at appear in your applicationUs interface. >isual attributes can include t"e follo,ing properties4

Shik Mahamood Ali 30 Font properties4 Font 1ame+ Font &i7e+ Font &tyle+ Font ;idt"+ Font ;eig"t )olor and pattern properties4 Foreground )olor+ Bac2ground )olor Fill #attern+ )"armode $ogical 5ttribute+ ;"ite on Blac2 It can be c"anged dynamically. >isual attribute name is connected to an ob0ect by setting #isual attri!ute name property &et=item=property9Vtext!E+current=record=attribute+Ev!E:F >isual 5ttribute Types !. Default &etting t"e >isual 5ttribute Group property to Default specifies t"at t"at t"e ob0ect s"ould be displayed ,it" default color+ pattern+ and font settings. ;"en >isual 5ttribute Group is set to Default+ t"e individual attribute settings reflect t"e current system defaults. T"e actual settings are determined by a combination of factors+ including t"e type of ob0ect+ t"e resource file in use+ and t"e ,indo, manager. (. )ustom ;"en t"e attribute of an ob0ects are c"anged at design tome+ t"ey are custom >5T -. 1amed &etting t"e >isual 5ttribute Group property to a named visual attribute defined in t"e same module specifies t"at t"e ob0ect s"ould use t"e attribute settings defined for t"e named visual attribute. 5 named visual attribute is a separate ob0ect in a form or menu module t"at defines a collection of visual attribute properties. /nce you create a named visual attribute+ you can apply it to any ob0ect in t"e same module+ muc" li2e styles in a ,ord processing program. EDITOR T"is ob0ect enables t"e operator to edit text. T"ere are t"ree types of editor ob0ects4 default editor+ system editor+ and userMnamed editor. !. &ystem ditor T"e system editor to be used is defined by t"e F/.M&<J= DIT/. environment variable. T"e editor specified must use t"e 5&)II text format. For information on environment variables and system editor availability+ refer to t"e Form Builder documentation for your operating system. F/.M&<J= DIT/. K )4W;I1D/;&W1/T #5D. X (. Default ditor Default editor is invo2ed at runtime+ Form Builder determines its display si7e and position dynamically based on t"e si7e and position of t"e text item from ,"ic" t"e editor ,as invo2ed. -. UserM1amed ditor 5 userMnamed editor "as t"e same text editing functionality as t"e default editor. 6ou create a userMnamed editor ,"en you ,ant to display t"e editor programmatically ,it" &G/;= DIT/.+ or ,"en you ,ant to specify custom editor attributes suc" as scroll bar and title. &G/;= DIT/.9editor=name+ message=in+ x+ y+ message=out+ result:F T"e &G/;= DIT/. procedure displays a userMnamed editor at t"e specified display coordinates. &G/;= DIT/. ta2es message=in and message=out parameters t"at

Shik Mahamood Ali 31 allo, you to pass a text string in to t"e editor and to get t"e edited text string bac2 ,"en t"e operator accepts t"e editor. dit=Textitem9x+ y+ ,idt"+ "eig"t:F T"e DIT=T XTIT M procedure invo2es t"e editor associated ,it" t"e current text item in t"e form 9t"e default editor+ a userMnamed editor+ or t"e current system editor:. Exampl ! %C CC BuiltBin4 &G/;= DIT/. CC xample4 5ccept input from t"e operator in a userBdefined CC editor. Use t"e system editor if t"e user "as CC c"ec2ed t"e X&ystem= ditorX menu item under t"e CC X#referencesX menu in our custom menu module. C% D )$5. ed=id ditorF mi=id MenuItemF ed=name >5.)G5.(93J:F val >5.)G5.(9-(JJJ:F ed=o2 B//$ 51F B GI1 mi=id 4K Find=Menu=Item9E#. F . 1) &.&6&T M= DIT/.E:F IF Get=Menu=Item=#roperty9mi=id+)G )D D: K ET.U E TG 1 ed=name 4K Esystem=editorEF $& ed=name 4K Emy=editor!EF 1D IFF ed=id 4K Find= ditor9 ed=name :F %C CC &"o, t"e appropriate editor at position 9!J+!3: on t"e CC screen. #ass t"e contents of t"e 4emp.comments item CC into t"e editor and reassign t"e edited contents if CC Eed=o2E returns boolean T.U . C% val 4K 4emp.commentsF &"o,= ditor9 ed=id+ val+ !J+!3+ val+ ed=o2:F IF ed=o2 TG 1 4emp.comments 4K valF 1D IFF 1DF Exampl ! %C CC BuiltBin4 DIT=T XTIT M CC xample4 Determine t"e xBposition of t"e current item CC t"en bring up t"e editor eit"er on t"e left CC side or rig"t side of t"e screen so as to not CC cover t"e item on t"e screen. C% D )$5. itm=x=pos 1UMB .F B GI1 itm=x=pos 4K Get=Item=#roperty94&ystem.)ursor=Item+X=#/&:F IF itm=x=pos I 3J TG 1 dit=TextItem9!+!+(J+@:F $& dit=TextItem9<J+!+(J+@:F 1D IFF

Shik Mahamood Ali 1DF C#N)#S

32

T"is ob0ect represents a bac2ground entity on ,"ic" you place interface items+ suc" as c"ec2 boxes+ radio groups+ and text items. T"ere are four types of canvas ob0ects4 )ontent+ &tac2ed+ Gori7ontal Toolbar+ and >ertical Toolbar. $,Cont nt Can9as T"e most common canvas type is t"e content canvas 9t"e default type:. 5 content canvas is t"e ObaseO vie, t"at occupies t"e entire content pane of t"e ,indo, in ,"ic" it is displayed. 6ou must define at least one content canvas for eac" ,indo, you create. %,Sta/: 8 Can9as 5 stac2ed canvas is displayed atopYor stac2ed onYt"e content canvas assigned to t"e current ,indo,. &tac2ed canvases obscure some part of t"e underlying content canvas+ and often are s"o,n and "idden programmatically. 6ou can display more t"an one stac2ed canvas in a ,indo, at t"e same time. &,Ta0 Can9as 5 tab canvasYmade up of one or more tab pages Yallo,s you to group and display a large amount of related information on a single dynamic Form Builder canvas ob0ect. $i2e stac2ed canvases+ tab canvases are displayed on top of a content canvas+ partly obscuring it. Tab pages 9t"at collectively comprise t"e tab canvas: eac" display a subset of t"e information displayed on t"e entire tab canvas. ',Tool0ar Can9as 5 toolbar canvas often is used to create toolbars for individual ,indo,s. 6ou can create t,o types of toolbar canvases4 "ori7ontal or vertical. Gori7ontal toolbar canvases are displayed at t"e top of a ,indo,+ 0ust under its menu bar+ ,"ile vertical toolbars are displayed along t"e far left edge of a ,indo,. &"o,ing and "iding a canvas programmatically &G/;=>I ;9Ua=stac2U:F or & T=>I ;=#./# .T69Ua=stac2U+ visible+ property=true:F GID =>I ;9Ua=stac2U:F or & T=>I ;=#./# .T69Ua=stac2U+ visible+ property=false:F (INDO( 5 ,indo, is a container for all visual ob0ects t"at ma2e up a Form Builder application+ including canvases. 5 single form can include any number of ,indo,s. ;"ile every ne, form automatically includes a default ,indo, named ;I1D/;!+ you can create additional ,indo,s as needed by inserting t"em under t"e ;indo,s node in t"e /b0ect 1avigator. T"ere are t,o ,indo, styles4 Document Document ;indo,s Document ,indo,s typically display t"e main canvases and ,or2 areas of your application ,"ere most data entry+ and data retrieval is performed. Dialog Dialog ;indo,s Dialog ,indo,s are freeMfloating+ containers typically used for modal dialogs t"at re*uire immediate user interaction.

Shik Mahamood Ali ;indo, Modality

33

!.Modal ;indo,s Modal ,indo,s are usually used as dialogs+ and "ave restricted functionality compared to modeless ,indo,s. /n some platforms+ for example+ end users cannot resi7e+ scroll+ or iconify a modal ,indo,. Modal ,indo,s are often displayed ,it" a platformMspecific border uni*ue to modal ,indo,s. /n some platforms+ modal ,indo,s are Oal,aysMonM topO ,indo,s t"at cannot be layered be"ind modeless ,indo,s. (. Modeless ;indo,s 6ou can display multiple modeless ,indo,s at t"e same time+ and end users can navigate freely among t"em 9provided your application logic allo,s it:. /n most GUI platforms+ you can layer modeless ,indo,s so t"at t"ey appear eit"er in front of or be"ind ot"er ,indo,s. Gide on xit property For a modeless ,indo,+ determines ,"et"er Form Builder "ides t"e ,indo, automatically ,"en t"e end user navigates to an item in anot"er ,indo,. MDI and &DI ,indo,s !. Multiple Document Interface MDI applications display a default parent ,indo,+ called t"e application ,indo,. 5ll ot"er ,indo,s in t"e application are eit"er document ,indo,s or dialog ,indo,s.Document ,indo,s al,ays are displayed ,it"in t"e MDI application ,indo, frame. (. &ingle Document Interface 5lt"oug" MDI is t"e default system of ,indo, management during Forms .untime+ Form Builder also provides support for an &DI root ,indo, on Microsoft ;indo,s. . #$5) =)/1T 1T=>I ; builtMin .eplaces t"e content canvas currently displayed in t"e indicated ,indo, ,it" a different content canvas. . #$5) =)/1T 1T=>I ; 9,indo,=name >5.)G5.(+ vie,=name >5.)G5.(:F

CC BuiltMin4 . #$5) =)/1T 1T=>I ; CC xample4 .eplace t"e UsalaryU vie, ,it" t"e U"istoryU CC vie, in t"e Uemployee=statusU ,indo,. C% B GI1 .eplace=)ontent=>ie,9Uemployee=statusU+U"istoryU:F 1DF Trigger M ;indo,s ;"enM;indo,M5ctivated ;indo,M.esi7ed #LERT 5n alert is a modal ,indo, t"at displays a message notifying t"e operator of some application condition. Use alerts to advise operators of unusual situations or to ,arn operators ,"o are about to perform an action t"at mig"t "ave undesirable or unexpected conse*uences. T"ere are t"ree styles of alerts4 &top+ )aution+ and 1ote. ac" style denotes a different level of message severity. Message severity is represented visually by a uni*ue icon t"at displays in t"e alert ,indo,. + ;"enM;indo,MDeactivated + ;"enM;indo,M)losed + ;"enM

Shik Mahamood Ali 34 FI1D=5$ .T 9alert=name >5.)G5.(:F &earc"es t"e list of valid alerts in Form Builder. ;"en t"e given alert is located+ t"e subprogram returns an alert ID. 6ou must return t"e ID to an appropriately typed variable. Define t"e variable ,it" a type of 5lert. ID=1U$$ 95lert B//$ 51:F .eturns a B//$ 51 value t"at indicates ,"et"er t"e ob0ect ID is available. & T=5$ .T=BUTT/1=#./# .T69alert=id 5$ .T+button 1UMB .+property >5.)G5.(+ value >5.)G5.(:F )"anges t"e label on one of t"e buttons in an alert. & T=5$ .T=#./# .T6 9alert=id 5$ .T+ >5.)G5.(:F )"anges t"e message text for an existing alert. property 1UMB .+ message

&G/;=5$ .T 9alert=id 5lert:F Displays t"e given alert+ and returns a numeric value ,"en t"e operator selects one of t"ree alert buttons. CC BuiltMin4 & T=5$ .T=#./# .T6 CC xample4 #laces t"e error message into a userMdefined alert CC named UMy= rror=5lertU and displays t"e alert. CC Trigger4 /nM rror C% D )$5. err=txt >5.)G5.(9@J: 4K rror=TextF al=id 5lertF al=button 1umberF B GI1 al=id 4K Find=5lert9UMy= rror=5lertU:F &et=5lert=#roperty9al=id+ alert=message=text+ err=txt :F al=button 4K &"o,=5lert9 al=id :F 1DF OBJECT 1ROUPS 5n ob0ect group is a container for a group of ob0ects. 6ou define an ob0ect group ,"en you ,ant to pac2age related ob0ects so you can copy or subclass t"em in anot"er module. /b0ect groups provide a ,ay to bundle ob0ects into "ig"erMlevel building bloc2s t"at can be used in ot"er parts of an application and in subse*uent development pro0ects. 6ou define an ob0ect group ,"en you ,ant to pac2age related ob0ects for copying or sub classing in anot"er module. 6ou can use ob0ect groups to bundle numerous ob0ects into "ig"erMlevel building bloc2s t"at you can use again in anot"er application. Using /b0ect Groups Q Bloc2s include4 Items ItemMlevel triggers Bloc2Mlevel triggers .elations Q /b0ect groups cannot include ot"er ob0ect groups Q Deleting4 5n ob0ect group does not affect t"e ob0ects 5n ob0ect affects t"e ob0ect group )opying an /b0ect

Shik Mahamood Ali

35

)opying an ob0ect creates a separate+ uni*ue version of t"at ob0ect in t"e target module. 5ny ob0ects o,ned by t"e copied ob0ect are also copied. Use copying to export t"e definition of an ob0ect to anot"er module. Q )"anges made to a copied ob0ect in t"e source module do not affect t"e copied ob0ect in t"e target module. &ubclassing &ubclassing is an ob0ectMoriented term t"at refers to t"e follo,ing capabilities4 Q In"eriting t"e c"aracteristics of a base class 9In"eritance: Q /verriding properties of t"e base class 9&peciali7ation: OBJECT LIBR#RY T"is ob0ect provides an easy met"od of reusing ob0ects and enforcing standards across t"e entire development organi7ation. 6ou can use t"e /b0ect $ibrary to create+ store+ maintain+ and distribute standard and reusable ob0ects. In addition+ by using /b0ect $ibraries+ you can rapidly create applications by dragging and dropping predefined ob0ects to your form. Q Q Q Q Is a convenient container of ob0ects for reuse &implifies reuse in complex environments &upports corporate+ pro0ect+ and personal standards &implifies t"e s"aring of reusable components

O!$ect li!raries are convenient containers of ob0ects for reuse. T"ey simplify reuse in complex environments+ and t"ey support corporate+ pro0ect+ and personal standards. 5n ob0ect library can contain simple ob0ects+ property classes+ ob0ect groups+ and program units+ but t"ey are protected against c"ange in t"e library. /b0ects can be used as standards 9classes: for ot"er ob0ects.
/b0ect libraries simplify t"e s"aring of reusable components. .eusing components enables you to4

Q 5pply standards to simple ob0ects+ suc" as buttons and items+ for a consistent loo2 and feel Q .euse complex ob0ects suc" as a 1avigator

Benefits of t"e /b0ect $ibrary Q &implifies t"e s"aring and reuse of ob0ects Q #rovides control and enforcement of standards Q liminates t"e need to maintain multiple referenced forms

&M5.T)$5&& 5 &mart)lass is a special member of an /b0ect $ibrary. Unli2e ot"er /b0ect $ibrary members+ it can be used to subclass existing ob0ects in a form using t"e &mart)lass option from t"e rig"t mouse button popup menu. /b0ect $ibrary members ,"ic" are not &mart)lasses can only be used to create ne, ob0ects in form modules into ,"ic" t"ey are added.

Shik Mahamood Ali 36 If you fre*uently use certain ob0ects as standards+ suc" as standard buttons+ date items+ and alerts+ you can mar2 t"em as &mart)lasses by selecting eac" ob0ect in t"e ob0ect library and c"oosing /b0ectYI&mart)lass. 6ou can mar2 many different ob0ects t"at are spread across multiple ob0ect libraries as &mart)lasses. Q Is an ob0ect in an ob0ect library t"at is fre*uently used as a class Q )an be applied easily and rapidly to existing ob0ects Q )an be defined in many ob0ect libraries 6ou can "ave many &mart)lasses of a given ob0ect PL;S+L Li0rari s 5 li!rar is a collection of #$%&'$ program units+ including procedures+ functions+ and pac2ages. 5 single library can contain many program units t"at can be s"ared among t"e /racle Developer modules and applications t"at need to use t"em. 5 library4 Is produced as a separate module and stored in eit"er a file or t"e database #rovides a convenient means of storing clientMside code and s"aring it among applications Means t"at a single copy of program units can be used by many form+menu+ report+ or grap"ic modules &upports dynamic loading of program units FU1)TI/1 locate=emp9bind=value I1 1UMB .: . TU.1 >5.)G5.( I& v=ename >5.)G5.(9!8:F B GI1 & $ )T ename I1T/ v=ename F./M emp ;G . empno K bind=valueF . TU.19v=ename:F 1DF

.easons to s"are ob0ects and code4 Increased productivity Increased modularity Decreased maintenance Maintaining standards .#$$ .#$D .#$X #$%&'$ $ibrary Module Binary #$%&'$ $ibrary Module Text #$%&'$ $ibrary Module xecutable

.MMB Menu Module Binary .MMT Menu Module Text .MMX Menu Module xecutable

Form Buil8 r Built-in Pa/:a7 X )=&'$ #rovides builtMins for executing dynamic &'$ ,it"in #$%&'$ procedures

Shik Mahamood Ali 37 )B< #rovides builtMins for controlling and interacting ,it" >BX controlsF t"is pac2age ,or2s only in a !<Mbit environment and is provided for bac2,ard compatibility (EB #rovides builtMins for t"e ;eb environment OLE% #rovides a #$%&'$ 5#I for creating+ manipulating+ and accessing attributes of /$ ( automation ob0ects SUBPRO1R#M 5 subprogram can be eit"er a procedure or a function. BuiltMin subprograms are t"erefore called in t,o distinct ,ays4 Q BuiltMin procedures4 )alled as a complete statement in a trigger or program unit ,it" mandatory arguments. Q BuiltMin functions4 )alled as part of a statement+ in a trigger or program unit+ at a position ,"ere t"e functionEs return value ,ill be used. 5gain+ t"e function call must include any mandatory arguments. TRIGGER Triggers are bloc2s of #$%&'$ code t"at are ,ritten to perform tas2s ,"en a specific event occurs ,it"in an application. In effect+ a Form Builder trigger is an eventM"andler ,ritten in #$%&'$ to augment 9or occasionally replace: t"e default processing be"avior. very trigger "as a name+ and contains one or more #$%&'$ statements. 5 trigger encapsulates #$%&'$ code so t"at it can be associated ,it" an event and executed and maintained as a distinct ob0ect.

Trigger Scope

1.Form Level The trigger belongs to the form and can fire due to events across the entire form. 2.Block Level The trigger belongs to a block and can only fire when this block is the current block. .!tem Level The trigger belongs to an individual item and can only fore when this item is the current item. Trigger #roperties
Execution Style

"#ecution $ierarchy property Specifies how the current trigger code should e#ecute if there is a trigger with the same name defined at a higher level in the ob%ect hierarchy. The following settings are valid for this property& 'verride Specifies that the current trigger fire instead of any trigger by the same name at any higher scope. This is known as (override parent( behavior.

Shik Mahamood Ali 38 Before Specifies that the current trigger fire before firing the same trigger at the ne#t)higher scope. This is known as (fire before parent( behavior. *fter Specifies that the current trigger fire after firing the same trigger at the ne#t)higher scope. This is known as (fire after parent( behavior.

What are triggers used for?


*alidate data ent&+ '&ote$t the data,ase f&om o(e&ato& e&&o&s -imit o(e&ato& a$$ess to s(e$ified fo&ms %is(la+ &elated field data ,+ (e&fo&min) ta,le look (s #om(a&e .al es ,et/een fields in the fo&m #al$ late field .al es and dis(la+ the &es lts of those $al$ lations 'e&fo&m $om(le0 t&ansa$tions1 s $h as .e&if+in) totals %is(la+ $ stomi2ed e&&o& and info&mation messa)es to the o(e&ato& Alte& defa lt na.i)ation %is(la+ ale&t ,o0es #&eate1 initiali2e1 and in$&ement time&s

Groups of triggers
GROUP FUNCTION

3hen-t&i))e&s "n-t&i))e&s '&e- and 'ost-t&i))e&s 6e+-t&i))e&

40e$ te in addition to defa lt (&o$essin) 5e(la$e defa lt (&o$essin) Add (&o$essin) ,efo&e o& afte& an e.ent #han)e defa lt (&o$essin) assi)ned to a s(e$ifi$ ke+

7&i))e& #ate)o&ies 8lo$k-(&o$essin) t&i))e&s o 3hen-#&eate-5e$o&d o 3hen-#lea&-8lo$k o 3hen-%ata,ase-5e$o&d o 3hen-5emo.e-5e$o&d Inte&fa$e e.ent t&i))e&s o 3hen-8 tton-'&essed o 3hen-#he$k,o0-#han)ed o 3hen-Ima)e-A$ti.ated

Shik Mahamood Ali o o o o o o o o o o o o o 3hen-Ima)e-'&essed 3hen-5adio-#han)ed 3hen-7ime&-40(i&ed 3hen 9-ist-#han)ed 3hen 9-ist-A$ti.ated When Tree-Note-Activated When Tree-Note-Expanded When Tree-Note-Selected 6e+- :all; 3hen-3indo/-A$ti.ated 3hen-3indo/-#losed 3hen-3indo/-%ea$ti.ated 3hen-3indo/-5esi2ed

39

Maste&-detail t&i))e&s o "n-#he$k-%elete-Maste& o "n-#lea&-%etails o "n-'o( late-%etails Messa)e-handlin) t&i))e&s o "n-4&&o& o "n-Messa)e Na.i)ational t&i))e&s o '&e- and 'ost- 7&i))e&s o '&e-<o&m '&e-8lo$k '&e-5e$o&d '&e-7e0t-Item 'ost-7e0t-Item 'ost-5e$o&d 'ost-8lo$k 'ost-<o&m

3hen-Ne/-Instan$e-7&i))e&s 3hen-Ne/-<o&m-Instan$e 3hen-Ne/-8lo$k-Instan$e 3hen-Ne/-5e$o&d-Instan$e 3hen-Ne/-Item-Instan$e

= e&+-time t&i))e&s o o '&e-= e&+ 'ost-= e&+

7&ansa$tional t&i))e&s> o o o "n-#o nt "n-%elete> "n-Inse&t>

Shik Mahamood Ali o "n--o$k> o "n--o)on> o "n--o)o t> o "n-Sele$t> o "n-?(date> o o o o o o o o o o o 'ost-%ata,ase-#ommit> 'ost-%elete> 'ost-<o&ms-#ommit> 'ost-Inse&t> 'ost 9 Sele$t> 'ost-?(date> '&e-#ommit> '&e-%elete> '&e-Inse&t> '&e-Sele$t> '&e-?(date>

40

*alidation t&i))e&s o o 3hen-*alidate-Item 3hen-*alidate-5e$o&d

Mo se 4.ent 7&i))e&s o o o o o o o o 3hen-# stom-Item-4.ent 3hen-Mo se-#li$k 3hen-Mo se-%o ,le #li$k 3hen-Mo se-%o/n 3hen-Mo 3hen-Mo 3hen-Mo 3hen-Mo se-4nte& se--ea.e se-Mo.e se-?(

6e+-<n 7&i))e& o A 6e+-<n t&i))e& fi&es /hen an o(e&ato& (&esses the asso$iated ke+> o ?se 6e+-<n t&i))e&s to $&eate additional f n$tion ke+s fo& $ stom f n$tions> #allin) se&-named t&i))e&s

TRIGGER CATEGORIES

A. BLOCK-PROCESSING TRIGGERS
Bloc2 processing triggers fire in response to events related to record management in a bloc2.

1. When-Create-Record
Fires ,"en Form Builder creates a ne, record. For example+ ,"en t"e operator presses t"e RInsertS 2ey+ or navigates to t"e last record in a set ,"ile scrolling do,n+ Form Builder fires t"is trigger.

Shik Mahamood Ali Used For

41

#erform an action ,"enever Form Builder attempts to create a ne, record in a bloc2. For example+ to set complex+ calculated+ or dataMdriven default values t"at must be specified at runtime+ rat"er t"an design time.

Fires In
). 5T =. )/.D

+$",)-."*T")."-'./ T.!00". T"is example assigns dataMdriven or calculated default values ,it"out mar2ing t"e record as c"anged. /"-L*." -1.S'. ship2dflt !S S"L"-T val F.'3 cust2pref +$"." -ustid 4 &-ustomer.-ustid *,/ pref 4 5S$!657 B"0!, 89 99 /efault !nvoice /ue /ate based on -ustomer5s 99 ,et /ays *llowed value from the -ustomer block. 98 &!nvoice./ue2/ate &4 S:S/*T" ; &-ustomer.,et2/ays2*llowed7 89 99 /efault the shipping method based on this customers 99 preference< stored in a preference table. +e could 99 use S"L"-T...!,T'< but e#plicit cursor is more 99 efficient. 98 '6", ship2dflt7 F"T-$ ship2dflt !,T' &!nvoice.Ship23ethod7 -L'S" ship2dflt7 ",/7

2. When-Clear-Block
#erform an action ,"enever Form Builder flus"es t"e current bloc2F t"at is+ removes all records from t"e bloc2. T"e ;"enM)learMBloc2 trigger does not fire ,"en Form Builder clears t"e current bloc2 during t"e )$ 5.=F/.M event.

Used For
Use a ;"enM)learMBloc2 trigger to perform an action every time Form Builder flus"es t"e current bloc2. For example+ you mig"t ,ant to perform an automatic commit ,"enever t"is condition occurs. In a ;"enM)learMBloc2 trigger+ t"e value of &6&T M.. )/.D=&T5TU& is unreliable because t"ere is no current record. 5n alternative is to use G T=. )/.D=#./# .T6 to obtain t"e record status. Because G T=. )/.D=#./# .T6 re*uires reference to a specific record+ its value is al,ays accurate.

Fires In
)$ 5.=B$/)D )/U1T='U .6 1T .='U .6

Clear_Block(No_Validate);

3. When-Database-Record
Fires ,"en Form Builder first mar2s a record as an insert or an update. T"at is t"e trigger fires as soon as Form Builder determines t"roug" validation t"at t"e record s"ould be processed by t"e next post or commit as an insert or update. T"is generally occurs only ,"en t"e operator modifies t"e first item in a record+ and after t"e operator attempts to navigate out of t"e item.

Used For
#erform an action ,"enever Form Builder c"anges a recordUs status to Insert or Update+ t"us indicating t"at t"e record s"ould be processed by t"e next )/MMIT=F/.M operation

Shik Mahamood Ali

42

Use a ;"enMDatabaseM.ecord trigger to perform an action every time a record is first mar2ed as an insert or an update.

4. When-Remove-Record
Fires ,"enever t"e operator or t"e application clears or deletes a record. #erform an action ,"enever a record is cleared or deleted. For example+ to ad0ust a running total t"at is being calculated for all of t"e records displayed in a bloc2.

Fires In
)$ 5.=. )/.D D $ T =. )/.D

B.INTERFACE EVENT TRIGGERS


Interface event triggers fire in response to events t"at occur in t"e form interface. &ome of t"ese trigger+ suc" as ;"enMButtonM#ressed+ fire only in response to operator input or manipulation. /t"ers+ li2e ;"enM;indo,M5ctivated+ can fire in response to bot" operator input and programmatic control.

1. When-Button-Pressed
Fires ,"en an operator selects a button+ by clic2ing ,it" a mouse+ or using t"e 2eyboard.

Usage Notes
Use a ;"enMButtonM#ressed trigger to perform navigation+ to calculate text item values+ or for ot"er item+ bloc2+ or form level functionality.

This example executes a COMMIT_FORM if there are changes in the form. BEGIN

IF :System.Form_Status = C!"NGE# $!EN Commit_Form; %& I' t(e Form_Status is )ot *ack to +,E-. && 'ollo/i)0 a commit1 t(e) t(e commit /as )ot success'ul. &% IF :System.Form_Status 23 +,E-. $!EN 4essa0e( ,)a*le to commit order to data*ase... ); -"ISE Form_$ri00er_Failure; EN# IF; EN# IF;

EN#;

2. When-Checkbox-Changed
Fires ,"en an operator c"anges t"e state of a c"ec2 box+ eit"er by clic2ing ,it" t"e mouse+ or using t"e 2eyboard.

Initiate an action ,"en t"e operator toggles t"e state of a c"ec2 box+ eit"er ,it" t"e mouse or t"roug" 2eyboard selection Usage Notes
Use a ;"enM)"ec2boxM)"anged trigger to initiate a tas2 dependent upon t"e state of a c"ec2 box. ;"en an operator clic2s in a c"ec2 box+ t"e internal value of t"at item does not c"ange until

Shik Mahamood Ali

43

navigation is completed successfully. T"us+ t"e ;"enM)"ec2boxM)"anged trigger is t"e first trigger to register t"e c"anged value of a c"ec2 box item. &o for all navigation triggers t"at fire before t"e ;"enM)"ec2boxM)"anged trigger+ t"e value of t"e c"ec2 box item remains as it ,as before t"e operator navigated to it.

When-Checkbox-Changed Trigger examples


T"is trigger on t"e 4&=ord.order=filled item prevents t"e date=s"ipped item from being updated if t"e user mar2s t"e order as filled 9 c"ec2ed on :.If t"e c"ec2 box is set off+ t"en t"e Date=&"ipped item is enabled.

Begin If checkbox_checked(s_ord.filled) then Set_Item_Property(s_ord.date_shipped !pdate_allo"ed property_false)# $lse Set_Item_Property(s_ord.date_shipped !pdate_allo"ed property_tr%e)# $nd if# $nd#

3. When- mage-!ct"vated
Initiate an action ,"enever t"e operator doubleMclic2s an image item.
Fires ,"en an operator uses t"e mouse to4

&ingleMclic2 on an image item. DoubleMclic2 on an image item.

Note : $(at 5(e)6Ima0e67ressed also 'ires o) a dou*le6click.

4. When- mage-Pressed
Initiate an action ,"enever an operator clic2s on an image item.
Fires ,"en an operator uses t"e mouse to4 &ingleMclic2 on an image item DoubleMclic2 on an image item %ote 4 T"at ;"enMImageM5ctivated also fires on a doubleMclic2.

Usage Notes Use a ;"enMImageM#ressed trigger to perform an action ,"en an operator clic2s or double clic2s
on an image item.

Be0i) -E"#_I4"GE_FI8E(9S$_:;;$<_C!"-(:S$4"S$.S$I#);;:.=7G:1:=7G:1:S$4"S$:S$I4"GE:); E)d; T"e above ;"en=Image=#ressed trigger on t"e stimage item displays a image of t"e current student 9in t"e stmast bloc2: ,"en t"e user clic2s t"e image item.

#. When-$"st-!ct"vated %r"gger
Fires ,"en an operator doubleMclic2s on an element in a list item t"at is displayed as a TMlist.

Usage Notes

Shik Mahamood Ali

44

# (= n-List-#/ti9at 8 tri77 r 6ir s onl. 6or T-list st.l list it ms> not 6or 8rop8o?n lists or /om0o 0ox st.l list it ms, T"e display style of a list item is determined by t"e $ist &tyle property.

&. When-$"st-Changed %r"gger


Description
Fires ,"en an end user selects a different element in a list item or deMselects t"e currently selected element. In addition+ if a ;"enM$istM)"anged trigger is attac"ed to a combo box style list item+ it fires eac" time t"e end user enters or modifies entered text.

Usage Notes
Use a ;"enM$istM)"anged trigger to initiate an action ,"en t"e value of t"e list is c"anged directly by t"e end user. T"e ;"enM$istM)"anged trigger is not fired if t"e value of t"e list is c"anged programmatically suc" as by using t"e DU#$I)5T =IT M builtMin+ or if t"e end user causes a procedure to be invo2ed ,"ic" c"anges t"e value. For example+ t"e ;"enM$istM )"anged trigger ,ill not fire if an end user duplicates t"e item using a 2ey mapped to t"e DU#$I)5T =IT M builtM in.

Be0i) E>ce?tio) E)d;

Select st)ame i)to :st)ame 'rom t(e stmast /(ere stid=:stid; 5(e) )o_data_'ou)d t(e) 4essa0e(9I)@alid Stude)t 9);

#opulate student name based on t"e selected student id.

'. When-Rad"o-Changed
Description
5 fire ,"en an operator selects a different radio button in a radio group+ or deMselects t"e currently selected radio button+ eit"er by clic2ing ,it" t"e mouse+ or using t"e 2eyboard.

Initiate an action ,"en an operator c"anges t"e current radio button selected in a radio group item. Usage Notes
Use a ;"enM.adioM)"anged trigger to perform an action depending on t"e state of a radio group. 9DeMselecting a radio button in a radio group sets t"e radio group value to 1U$$F operators use t"is tec"ni*ue in nter 'uery mode to exclude a radio group from a *uery.: ;"en an operator clic2s an item in a radio group+ t"e internal value of t"at item does not c"ange until navigation is completed successfully. T"us+ t"e ;"enM.adioM)"anged trigger is t"e first trigger to register t"e c"anged value of a radio group. For all navigation triggers t"at fire before t"e ;"enM.adioM)"anged trigger+ t"e value of t"e radio group remains as it ,as before t"e operator navigated to it.

When-Radio-Changed Trigger examples


;"en t"e user selects credit as t"e payment type for an order+ t"is trigger immediately confirms ,"et"er t"e customer "as a good or excellent credit rating. If not+ t"en t"e payment type is set to cas".

#eclare Be0i)

@_credit customer.credit_rateAty?e; I' :s_ord.?ayme)t_ty?e=:C-E#I$: t(e)

Shik Mahamood Ali 45 Select credit_rate i)to @_credit 'rom customer /(ere custid=:s_ord.custid; I' @_credit N<$_IN(9G<<#:1:EBCE88EN$:) t(e) :s_ord.?ayme)t_ty?e:=:C"S!:; messa0e(95ar)i)0 C Customer must ?ay cas(9); E)d i'; E)d i'; E)d;

(. When-%"mer-)x*"red
Description
Fires ,"en a timer expires. Initiate an action ,"en a programmatic timer expires.

Usage Notes
Timers are created programmatically by calling t"e ). 5T =TIM . builtMin procedure. T"e ;"enMTimerM xpired trigger can not fire during trigger+ navigation+ or transaction processing. Use a ;"enMTimerM xpired trigger to initiate an event+ update item values+ or perform any tas2 t"at s"ould occur after a specified interval. 6ou can call G T=5##$I)5TI/1=#./# .T69TIM .=15M : in a ;"enMTimerM xpired trigger to determine t"e name of t"e most recently expired timer.

Fires In
#rocess xpired Timer

(= n-Tim r-Expir 8 Tri77 r

xampl s

Example $(e 'ollo/i)0 e>am?le dis?lays a messa0e *o> eac( time a re?eati)0 timer e>?ires. $(e 'ollo/i)0 e>am?le is 'rom a telemarketi)0 a??licatio)1 i) /(ic( sales calls are timed1 a)d messa0e *o>es are dis?layed to ?rom?t t(e sales?erso) t(rou0( eac( sta0e o' t(e call. $(e messa0e *o> is dis?layed eac( time a re?eati)0 timer e>?ires. &$'()*$ timer_id +I,$*# alert_id )($*+# call_stat%s -!,B$*# msg_. /)*'0)*1(23) 45 67rap %p the first phase of yo%r presentation6# msg_1 /)*'0)*1(23) 45 6,o8e into yo%r close.6# msg_9 /)*'0)*1(23) 45 6)sk for the order or repeat the close.6 t"o_min%tes -!,B$*(:) 45 (.13 ; .333)# one_and_half -!,B$*(<) 45 (=3 ; .333)# B$>I4>(?B)(.timer_co%nt 45 . B$>Itimer_id 45 @I-&_+I,$*(6tele_timer6)# alert_id 45 @I-&_)($*+(6tele_alert6)# I@ 4>(?B)(.timer_co%nt 5 . +0$Set_)lert_Property(alert_id )($*+_,$SS)>$_+$A+ call_stat%s 45 Sho"_)lert(alert_id)# msg_.)#

Shik Mahamood Ali

46

I@ call_stat%s 5 )($*+_B!++?-. +0$&elete_+imer(timer_id)# -ext_*ecord# $(SI@ call_stat%s 5 )($*+_B!++?-1 +0$4>(?B)(.timer_co%nt 45 3# $(S$ Set_+imer(timer_id t"o_min%tes -?_'0)->$)# $-& I@# $(SI@ 4>(?B)(.timer_co%nt 5 1 +0$'hange_)lert_,essage(alert_id msg_1)# call_stat%s 45 Sho"_)lert(alert_id)# I@ call_stat%s 5 )($*+_B!++?-. +0$&elete_+imer(timer_id)# -ext_*ecord# $(SI@ call_stat%s 5 )($*+_B!++?-1 +0$4>(?B)(.timer_co%nt 45 3# $(S$ Set_+imer(timer_id one_and_half $-& I@# $(S$ 'hange_)lert_,essage(alert_id msg_9)# call_stat%s 45 Sho"_)lert(alert_id)# I@ call_stat%s 5 )($*+_B!++?-. +0$&elete_+imer(timer_id)# -ext_*ecord# $(SI@ call_stat%s 5 )($*+_B!++?-1 +0$4>(?B)(.timer_co%nt 45 3# $(S$ Set_+imer(timer_id -?_'0)->$ -?_*$P$)+)# $-& I@# $-& I@# 4>(?B)(.timer_co%nt 5 1# $-&#

-?_'0)->$)#

+. When-W"ndo,-!ct"vated
Initiate an action ,"enever an operator or t"e application activates a ,indo,.
Fires ,"en a ,indo, is made t"e active ,indo,. T"is occurs at form startup and ,"enever a different ,indo, is given focus. 1ote t"at on some ,indo, managers+ a ,indo, can be activated by+ say+ clic2ing on its title bar. T"is operation is independent of navigation to an item in t"e ,indo,. T"us+ navigating to an item in a different ,indo, al,ays activates t"at ,indo,+ but ,indo, activation can also occur independently of navigation.

Usa7

Not s!

Use t"is trigger to perform t"e follo,ing types of tas2s4 )apture initial settings of ,indo, properties+ by ,ay of t"e G T=;I1D/;=#./# .T6 builtBin.

Shik Mahamood Ali 47 nforce navigation to a particular item ,"enever a ,indo, is activated. Deep trac2 of t"e most recently fired ,indo, trigger by assigning t"e value from &6&T M. > 1T=;I1D/; to a variable or global variable. Exampl ! Be0i) GE$_5IN#<5_7-<7E-$.( /i)do/_)ame1 ?ro?erty); E)d;

1- .When-W"ndo,-Closed
Initiate an action ,"enever an operator closes a ,indo, ,it" t"e ,indo, managerUs )lose command. Usage Notes: Use t"is trigger to programmatically close a ,indo, ,"en t"e operator issues t"e ,indo,Bmanager )lose command. 6ou can close a ,indo, ,it" t"e GID =;I1D/; + & T=;I1D/;=#./# .T6+ and XIT=F/.M builtBin subprograms. 6ou can "ide t"e ,indo, t"at contains t"e current item. Exampl ! T"e follo,ing example of a call to & T=;I1D/;=#./# .T6 from t"is trigger closes a ,indo, ,"enever t"e operator closes it by ,ay of t"e ,indo, manager operation4 Set_5i)do/_7ro?erty(:/i)do/_)ame:1 VISIB8E1 7-<7E-$._<FF);

11. When-W"ndo,-Deact"vated
Initiate an action ,"enever a ,indo, is deactivated as a result of anot"er ,indo, becoming t"e active ,indo,. Fires ,"en an operator deactivates a ,indo, by setting t"e input focus to anot"er ,indo,. Usage Notes: Use t"is trigger to audit t"e state of a ,indo, ,"enever t"e operator deactivates t"e ,indo, by setting t"e input focus in anot"er ,indo,.

12. When-W"ndo,-Res".ed
Initiate an action ,"enever a ,indo, is resi7ed+ eit"er by t"e operator or programmatically. Fires ,"en a ,indo, is resi7ed+ eit"er by t"e operator or programmatically t"roug" a call to . &IZ =;I1D/; or & T=;I1D/;=#./# .T6. 9 ven if t"e ,indo, is not currently displayed+ resi7ing t"e ,indo, programmatically fires t"e ;"enB;indo,B.esi7ed trigger.: T"is trigger also fires at form startup+ ,"en t"e root ,indo, is first dra,n. It does not fire ,"en a ,indo, is iconified. Usa7 Not s! Use t"is trigger to perform any one of t"e follo,ing types of tas2s4 )apture t"e c"anged ,indo, properties+ suc" as ,idt"+ "eig"t+ x coordinate+ or y coordinate. 5udit t"e actions of an operator. &et input focus in an item on t"e target ,indo,. Maintain certain visual standards by resetting ,indo, si7e if t"e ,indo, ,as improperly resi7ed.

Shik Mahamood Ali Exampl !

48

%& && BuiltCi): -ESIDE_5IN#<5 && E>am?le: Set 5i)do/E to *e t(e same siFe as 5i)do/G &% 7-<CE#,-E 4ake_Same_SiFe_5i)( 5i)do/G V"-C!"-E1 5i)do/E V"-C!"-E) IS /)_idG 5i)do/; / N,4BE-; ( N,4BE-; BEGIN /* ** Find indo!" and get it#s !idth and height. */ /)_idG := Fi)d_5i)do/(5i)do/G); / := Get_5i)do/_7ro?erty(/)_idG15I#$!); ( := Get_5i)do/_7ro?erty(/)_idG1!EIG!$); /* ** Resi$e indo!% to the same si$e */ -esiFe_5i)do/( 5i)do/E1 /1 ( );

EN#;

C, *EY- 2#LL3 @ *EY TRI11ERS A Dey Triggers "ave a oneMtoMone relations"ip ,it" specific 2eys. i.e+ t"e trigger fires ,"en operator presses a specific 2ey or 2eyMse*uence. .eplace t"e default function associated ,it" a function 2ey. For example+ you can define a DeyM XIT trigger to replace t"e default functionality of t"e RGelpS 2ey.

Key Triggers and Function Keys


KE T!"##E! DeyB)$.B$D DeyB)$.F.M DeyB)$.. ) DeyB)/MMIT DeyB)'U .6 DeyB). . ) DeyBD $. ) DeyBD/;1 DeyBDU#BIT M DeyBDU#. ) DeyB DIT DeyB 1T'.6 DeyB X '.6 DeyB XIT DeyBG $# DeyB$I&T>5$ DeyBM 1U DeyB1XTB$D DeyB1XTBIT M DeyB1XTD 6 DeyB1XT. ) DeyB1XT& T DeyB#.I1T DeyB#.>B$D DeyB#.>BIT M DeyB#.>. ) DeyB&).D/;1 DeyB&).U# DeyBU# ASS$%"ATE& FUN%T"$N KE R)lear Bloc2S R)lear FormS R)lear .ecordS R5cceptS R)ount 'uery GitsS RInsert .ecordS RDelete .ecordS RDo,nS RDuplicate ItemS RDuplicate .ecordS R ditS R nter 'ueryS R xecute 'ueryS R xitS RGelpS R$ist of >aluesS RBloc2 MenuS R1ext Bloc2S R1ext ItemS R1ext #rimary DeyS R1ext .ecordS R1ext &et of .ecordsS R#rintS R#revious Bloc2S R#revious ItemS R#revious .ecordS R&croll Do,nS R&croll UpS RUpS

Shik Mahamood Ali


DeyBU#D. )

49
*uivalent to .ecord+ $oc2 command on t"e default menu

1./e012n %r"gger
5 DeyBFn trigger fires ,"en an operator presses t"e associated 2ey. 6ou can attac" DeyBFn triggers to !J 2eys or 2ey se*uences t"at normally do not perform any /racle Forms operations. T"ese 2eys are referred to as DeyBFJ t"roug" DeyBFA. Before you can attac" 2ey triggers to t"ese 2eys+ you or t"e DB5 must use /racle Terminal to map t"e 2eys to t"e appropriate functions. Usa7 Not s! Use DeyBFn triggers to create additional function 2eys for custom functions.

2. /e013thers %r"gger
5 DeyB/t"ers trigger fires ,"en an operator presses t"e associated 2ey. 5 DeyB/t"ers trigger is associated ,it" all 2eys t"at can "ave 2ey triggers associated ,it" t"em but are not currently defined by function 2ey triggers 9at any level:. 5 DeyB/t"ers trigger overrides t"e default be"avior of a .unform function 2ey 9unless one of t"e follo,ing restrictions apply:. ;"en t"is occurs+ "o,ever+ /racle Forms still displays t"e function 2eyEs default entry in t"e &"o, Deys screen. Usa7 Not s! Use DeyB/t"ers triggers to limit an operatorEs possible actions. &pecifically+ use DeyB/t"ers triggers to perform t"e follo,ing tas2s4 Disable all 2eys t"at are not relevant in a particular situation. #erform one specific action ,"enever an operator presses any 2ey. D 6M)/MMIT T.IGG . 5T F/.M $ > $4 M#$/6 B GI1 IF G T=5##$I)5TI/1=#./# .T69 )5$$I1G=F/.M : I& 1U$$ TG 1 )/MMIT=F/.MF $& #/&TF 1D IFF & F/.M

1DF

D 6MD $. ) T.IGG . /1 &=)U&T/M . B$/)D D $ T =. )/.DF D 6M XIT 5T F/.M $ > $ & T=5$ .T=#./# .T6 9E*uestion=alertE+ 5$ .T=M &&5G =T XT+ EDo you really ,ant to leave t"e formPE:F IF &G/;=5$ .T 9E*uestion=alertE: K 5$ .T=BUTT/1! TG 1 XIT=F/.MF 1D IFF

D,M#STER-DET#IL TRI11ERS
Form Builder generates master8detail triggers automatically when a master8detail relation is defined between blocks. The default master8detail triggers enforce coordination between records in a detail block and the master record in a master block.

1. 3n-Check-Delete-4aster
Fires when Form Builder attempts to delete a record in a block that is a master block in a master8detail relation.

Shik Mahamood Ali

50

/"-L*." the2sum ,13B".7 B"0!, S"L"-T S13=dollar2amt> !,T' the2sum F.'3 po2distribution +$"." po2number 4 &purchase2order.number7 !F the2sum ?@ &purchase2order.total T$", 3essage=A6' /istributions do not reconcile.A>7 .*!S" Form2Trigger2Failure7 ",/ !F7 ",/7

2. 3n-Clear-Deta"ls
Fires when Form Builder needs to clear records in a block that is a detail block in a master8detail relation because those records no longer correspond to the current record in the master block.

Usa7 Not s! /racle Forms creates t"e /nB)learBDetails trigger automatically ,"en you define a masterB detail bloc2 relation.

3. 3n-Po*ulate-Deta"ls
Fires when Form Builder needs to fetch records into a block that is the detail block in a master8detail relation so that detail records are synchroniBed with the current record in the master block.

Usa7 Not s! Q Use an /nB#opulateBDetails trigger ,"en you "ave establis"ed a masterBdetail relations"ip and you ,ant to replace t"e default populate p"ase of a *uery. Q ;"en Immediate coordination is set+ t"is causes t"e details of t"e instantiated master to be populated immediately. Immediate coordination is t"e default. Q ;"en Deferred coordination is set and t"is trigger fires+ /racle Forms mar2s t"e bloc2s as needing to be coordinated. Q If you intend to manage bloc2 coordination yourself+ you can call t"e & T=B$/)D=#./# .T69)//.DI15TI/1=&T5TU&: builtBin.

E,MESS#1E--#NDLIN1 TRI11ERS Form Builder automatically issues appropriate error and informational messages in response to runtime events. Message "andling triggers fire in response to t"ese default messaging events.

1. 3n-)rror .eplace a default error message ,it" a custom error message+ or to trap and recover from an error.

Usage Notes
Use an /nB rror trigger for t"e follo,ing purposes4 To trap and recover from an error To replace a standard error message ,it" a custom message Use t"e ../.=)/D + ../.=T XT+ ../.=T6# + DBM&= ../.=T XT+ or DBM&= ../.=)/D builtBin function in an /nB rror trigger to identify a specific error condition. In most cases+ /nB rror triggers s"ould be attac"ed to t"e form+ rat"er t"an to a bloc2 or item. Trapping certain errors at t"e bloc2 or item level can be difficult if t"ese errors occur ,"ile /racle Forms is performing internal navigation+ suc" as during a )ommit process.

Exa'ple:

T"e follo,ing example c"ec2s specific error message codes and responds appropriately.

Shik Mahamood Ali

51

D )$5. lv=errcod 1UMB . 4K ../.=)/D F lv=errtyp >5.)G5.(9-: 4K ../.=T6# F lv=errtxt >5.)G5.(9@J: 4K ../.=T XTF B GI1 IF 9lv=errcod K 3Jnnn: TG 1 %C CC #erform some tas2s "ere C% $&IF 9lv=errcod K 3Jmmm: TG 1 %C CC More tas2s "ere C% ... $&IF 9lv=errcod K 3J777: TG 1 CC More tas2s "ere C% $& Message9lv=errtypLLEBELLto=c"ar9lv=errcod:LLE4 ELLlv=errtxt:F .5I& Form=Trigger=FailureF 1D IFF

1DF

2. 3n-4essage
To trap and respond to a messageF for example+ to replace a default message issued by Form Builder ,it" a custom message.

Usa7

Not s!

Use an /nBMessage trigger for t"e follo,ing purposes4 To trap and respond to an informative message To replace a standard informative message ,it" a custom message To exclude an inappropriate message

Exa'ple: T"e follo,ing example responds to an error message by displaying an alert t"at gives t"e user a message and gives t"e user t"e c"oice to continue or to stop4 /"-L*." alert2button ,13B".7 lv2errtype C*.-$*.2= > &4 3"SS*0"2T:6"7 lv2errcod ,13B". &4 3"SS*0"2-'/"7 lv2errt#t C*.-$*.2=DE> &4 3"SS*0"2T"FT7 B"0!, !F lv2errcod 4 GE HE T$", alert2button &4 Show2*lert=Acontinue2alertA>7 !F alert2button 4 *L".T2B1TT',1 T$", ... "LS" ... ",/ !F7 "LS" 3essage=lv2errtypIIAJAIIto2char=lv2errcod>IIA& AIIlv2errt#t>7 .*!S" Form2Trigger2Failure7 ",/ !F7 ",/7

F,+UERY-TIME TRI11ERS

Shik Mahamood Ali

52

Kuery)time triggers fire %ust before and %ust after the operator or the application e#ecutes a Luery in a block. 1. Pre-Query
>alidate t"e current *uery criteria or provide additional *uery criteria programmatically+ 0ust before sending t"e & $ )T statement to t"e database. T"is #reM'uery trigger on t"e &=/.D bloc2 only permits *ueries if t"ere is a restriction on eit"er t"e /rder ID+ Date /rdered+ or Date &"ipped. T"is prevents attempts at very large *ueries.

H H

$o test t(e o?erator:s Iuery co)ditio)s1 a)d to 'ail t(e Iuery ?rocess i' t(e co)ditio)s are )ot satis'actory 'or t(e a??licatio) $o add criteria 'or t(e Iuery *y assi0)i)0 @alues to *ase ta*le items " 7re6+uery tri00er 'ires *e'ore a Iuery e>ecutes. ,se it to c(eck or modi'y Iuery co)ditio)s.

4ake sure t(e user (as 0i@e) o)e o' t(e t/o Colum)s /(ic( /e (a@e i)de>ed i) t(eir searc( criteria1 ot(er/ise 'ail t(e Iuery /it( a (el?'ul messa0e "J IF :Em?loyee.E)ame IS N,88 "N# :Em?loyee.40r IS N,88 $!EN 4essa0e(:Su??ly Em?loyee Name a)d%or 4a)a0er Id :;;:'or +uery.:); -"ISE Form_$ri00er_Failure; EN# IF; K e>act_matc( C C(eck Bo> ,ser ca) s?eci'y i' or )ot a Iuery co)ditio) 'or a customer )ame s(ould e>actly matc( t(e ta*le @alue. K Set t(e i)itial @alue ?ro?erty to L.M. J IF )@l(:co)trol.e>act_matc(1:.:)=:N: t(e) :S_Customer.)ame:=:A:;;:S_customer.)ame ;; 9A:; EN# IF; 2. Post-Query #erform an action after fetc"ing a record+ suc" as loo2ing up values in ot"er tables based on a value in t"e current record. Fires once for eac" record fetc"ed into t"e bloc2.
T"is trigger is defined at bloc2 level or above. #ostM'uery fires for eac" record t"at is fetc"ed into t"e bloc2 as a result of a *uery. 1ote t"at t"e trigger only fires on t"e initial fetc" of a record not ,"en a record is subse*uently scrolled bac2 into vie, a second or t"ird time. Use #ostM'uery as follo,s4 To populate non database items as records are returned from a *uery To calculate statistics 5 #ostM'uery trigger fires as eac" record is fetc"ed 9except array processing:. Use it to perform calculations and populate additional items.

BJ

T"is #ostM'uery trigger on t"e &=/.D bloc2 selects t"e total count of line items for t"e current /rder+ and displays t"is number as a summary value in t"e non base table item 4$ineitem=count. Begin ndF & $ )T )/U1T9ord=id: I1T/ 4&=/.D.lineitem=count F./M &=IT M ;G . ord=id K 4&=/.D.idF

Example: $(is e>am?le retrie@es descri?tio)s 'or code 'ields1 'or dis?lay i) )o)Cdata*ase items i) t(e curre)t *lock.

Shik Mahamood Ali

53

#EC8"-E C,-S<- looku?_?ay?la) IS SE8EC$ 7ay?la)_#esc F-<4 7ay?la) 5!E-E 7ay?la)_Id = :Em?loyee.7ay?la)_Id; BEGIN C,-S<- looku?_area IS SE8EC$ "rea_Name F-<4 Di?_Code 5!E-E Di? = :Em?loyee.Di?;

%& 8ooku? t(e 7ayme)t 7la) #escri?tio) 0i@e) t(e 7ay?la)_Id i) t(e Em?loyee -ecord Nust 'etc(ed. && ,se E>?licit Cursor 'or (i0(est e''icie)cy.&% <7EN looku?_?ay?la); FE$C! looku?_?ay?la) IN$< :Em?loyee.7ay?la)_#esc_No)d*; C8<SE looku?_?ay?la); %& && 8ooku? "rea #escri?t 0i@e) t(e Di?code i) && t(e Em?loyee -ecord Nust 'etc(ed. ,se E>?licit && Cursor 'or (i0(est e''icie)cy. &% <7EN looku?_area; FE$C! looku?_area IN$< :Em?loyee."rea_#esc_No)d*; C8<SE looku?_area; EN#;
" Iuery 'etc(ed GO records !o/ ma)y times does a 7-E6+,E-. $ri00er a)d 7<S$6+,E-. $ri00er /ill 0et e>ecutedP 7-E6+,E-. 'ires o)ce. 7<S$6+,E-. 'ires GO times.

" 7re6+uery tri00er 'ires *e'ore a Iuery e>ecutes. ,se it to c(eck or modi'y Iuery co)ditio)s. " 7ost6+uery tri00er 'ires as eac( record is 'etc(ed (e>ce?t array ?rocessi)0). ,se it to ?er'orm calculatio)s a)d ?o?ulate additio)al items.

What is a difference between pre-select and pre-quer ! Fires duri)0 t(e e>ecute Iuery a)d cou)t Iuery ?rocessi)0 a'ter oracle 'orms co)structs t(e select stateme)t to *e issued1 *ut *e'ore t(e stateme)t is actually issued. $(e ?re6Iuery tri00er 'ires Nust *e'ore oracle 'orms issues t(e select stateme)t to t(e data*ase a'ter t(e o?erator as de'i)e t(e e>am?le records *y e)teri)0 t(e Iuery criteria i) e)ter Iuery mode. 7re6Iuery tri00er 'ires *e'ore ?re6select tri00er. 1,N#)I1#TION#L TRI11ERS 1avigational triggers fire in response to navigational events. For instance+ ,"en t"e operator clic2s on a text item in anot"er bloc2+ navigational events occur as Form Builder moves t"e input focus from t"e current item to t"e target item. I ] PRE- AND POST- TRIGGERS Fire as Form Builder navigates internally t"roug" different levels of t"e ob0ect "ierarc"y. (= n Do Pr - an8 Post-Na9i7ation Tri77 rs Fir B T"e #reM and #ostM navigation triggers fire during navigation+ t"at is 0ust before entry to or 0ust after exit from t"e ob0ect specified as part of t"e trigger name.

Shik Mahamood Ali


Exampl

54

T"e #reMTextMItem trigger fires 0ust before entering a text item.

(= n Do Na9i7ation Tri77 rs Not Fir B T"e #reM and #ostM navigation triggers do not fire if t"ey belong to a unit t"at is smaller t"an t"e current validation unit. For instance+ if t"e validation unit is .ecord+ #reM and #ostMTextMItem triggers do not fire. (=at -app ns (= n a Na9i7ation Tri77 r FailsB If a #reM or #ost navigation trigger fails+ t"e input focus returns to its initial location 9,"ere it ,as prior to t"e trigger firing:. To t"e user+ it appears t"at t"e input focus "as not moved at all.

&. Pre-Form #erform an action 0ust before Form Builder navigates to t"e form from OoutsideO t"e form+ suc" as at form startup.
IF not 9DBM&=& &&I/1.I&=./$ = 15B$ D9E5DMI1I&T.5TI> E: or 9DBM&=& &&I/1.I&=./$ = 15B$ D9ET )G1I)5$E: TG 1 M &&5G 9E6ou are not aut"ori7ed to run t"is applicationE:F #5U& F .5I& form=trigger=failureF 1D IFF

2. Pre-Block

Shik Mahamood Ali 55 #erform an action before Form Builder navigates to t"e bloc2 level from t"e form level. Fires during t"e nter t"e Bloc2 process+ during navigation from one bloc2 to anot"er.

Usa7

Not s!

Use a #reBBloc2 trigger to4 5llo, or disallo, access to a bloc2 &et variable values
Disabling stoc2=button ,"en leaving )/1T./$ bloc24 begin ndF & T=IT M=#./# .T69E)/1T./$.stoc2=buttonE+ enabled+ property=false:F

3. Pre-Record
#erform an action before Form Builder navigates to t"e record level from t"e bloc2 level.

Usage Notes:
Fires during t"e nter t"e .ecord process+ during navigation to a different record.

Use a #reB.ecord trigger to 2eep a running total.

T"e follo,ing trigger prevents t"e user from entering a ne, record given some dynamic condition and t"e status of &6&T M.. )/.D=&T5TU& evaluating to 1 ;. IF 99 dynamicBcondition: 51D 4&ystem..ecord=&tatus K E1 ;E: TG 1 .5I& Form=Trigger=FailureF 1D IFF

4. Pre-Text-Item #erform an action before Form Builder navigates to a text item from t"e record level. Usa7 Not s!

Use a #reBTextBItem trigger to perform t"e follo,ing types of tas2s4 Derive a complex default value+ based on ot"er items previously entered into t"e same record. .ecord t"e current value of t"e text item for future reference+ and store t"at value in a global variable or form parameter.

5. Post-Form #erform an action before Form Builder navigates to OoutsideO t"e form+ suc" as ,"en exiting t"e form. Fires during t"e $eave t"e Form process+ ,"en a form is exited. Usa7 Not s!

6ou can use a #ostBForm trigger for t"e follo,ing tas2s4 To clean up t"e form before exiting. For example+ use a #ostBForm trigger to erase any global variables t"at t"e form no longer re*uires. To display a message to t"e operator upon form exit.

Shik Mahamood Ali

56

T"is trigger does not fire ,"en t"e form is exited abnormally+ for example+ if validation fails in t"e form.

6. Post-Block Manipulate t"e current record ,"en Form Builder leaves a bloc2 and navigates to t"e form level.

Usage Notes: ?se a 'ost98lo$k t&i))e& to .alidate the ,lo$k@s $ &&ent &e$o&dA that is1 the &e$o&d that had in( t fo$ s /hen the -ea.e the 8lo$k e.ent o$$ &&ed> Bo mi)ht also se this t&i))e& to test a $ondition and (&e.ent the se& f&om lea.in) a ,lo$k ,ased on that $ondition> Set_item_?ro?erty (9co)trol.cmdsa@e:1 e)a*led1 ?ro?erty_'alse); 7. Post-Record Manipulate a record ,"en Form Builder leaves a record and navigates to t"e bloc2 level. Fires during t"e $eave t"e .ecord process. &pecifically+ t"e #ostB.ecord trigger fires ,"enever t"e operator or t"e application moves t"e input focus from one record to anot"er. T"e $eave t"e .ecord process can occur as a result of numerous operations+ including I1& .T=. )/.D+ D $ T =. )/.D+ 1 XT=. )/.D+ 1 XT=B$/)D+ ). 5T =. )/.D+ #. >I/U&=B$/)D+ etc. Usa7 Not s! Use a #ostB.ecord trigger ,"en you ,ant to perform an action ,"enever t"e operator or t"e application moves t"e input focus from one record to anot"er. For example+ if you ,ant to set a visual attribute for an item as t"e operator scrolls do,n t"roug" a set of records+ you can do so from ,it"in t"is trigger. Exa'ple: %& && BuiltCi): NEB$_-EC<-# && E>am?le: I' t(e curre)t item is t(e last item i) t(e && *lock1 t(e) ski? to t(e )e>t record i)stead o' && t(e de'ault o' 0oi)0 *ack to t(e 'irst item i) && t(e same *lock && $ri00er: QeyCNe>tCItem &% #EC8"-E cur_itm V"-C!"-E(RO) := :System.Cursor_Item; cur_*lk V"-C!"-E(RO) := :System.Cursor_Block; lst_itm V"-C!"-E(RO); BEGIN lst_itm := cur_*lk;;:.:;;Get_Block_7ro?erty(cur_*lk18"S$_I$E4); IF cur_itm = lst_itm $!EN Ne>t_-ecord; E8SE Ne>t_Item; EN# IF; EN#;

Exampl

Shik Mahamood Ali

57

8. Post-Text-Item Manipulate an item ,"en Form Builder leaves a text item and navigates to t"e record level. Fires during t"e $eave t"e Item process for a text item. &pecifically+ t"is trigger fires ,"en t"e input focus moves from a text item to any ot"er item. II] WHEN-NEW-INSTANCE-TRIGGERS Fire at t"e end of a navigational se*uence t"at places t"e input focus on a different item. &pecifically+ t"ese triggers fire 0ust after Form Builder moves t"e input focus to a different item+ ,"en t"e form returns to a *uiet state to ,ait for operator input.
(= n Do (= n-N ?- Co0D /tE-Instan/ Tri77 rs Fir B T"e ;"enM1e,M'o!$ect'MInstance triggers fire immediately after navigation to t"e ob0ect specified as part of t"e trigger name. Exampl T"e ;"enM1e,MItemMInstance trigger fires immediately after navigation to a ne, instance of an item.

1. When-5e,-2orm- nstance
#erform an action at form startMup. 9/ccurs after t"e #reMForm trigger fires:.
#erform a *uery of all orders+ ,"en t"e /.D .& form is run+ by including t"e follo,ing code in your ;"enM1e,MFormMInstance trigger4 !a. !b. X )UT ='U .6F B GI1 D F5U$T=>5$U 9EE+ EUG$/B5$.,"ere=clsE:F & T=B$/)D=#./# .T69Eprod=lov=bl2E+ D F5U$T=;G . +4G$/B5$.,"ere=cls:F X )UT ='U .6F

1DF !c. B GI1

X )UT ='U .6F 4G$/B5$.,idt"=,in=order 4K G T=;I1D/;=#./# .T69E,in=orderE+ ;IDTG:F 4G$/B5$."eig"t=,in=order 4K G T=;I1D/;=#./# .T69E,in=orderE+G IGGT:F 4G$/B5$.,idt"=,in=inventory 4K G T=;I1D/;=#./# .T69E,in=inventoryE+;IDTG:F 4G$/B5$."eig"t=,in=inventory 4K G T=;I1D/;=#./# .T69E,in=inventoryE+G IGGT:F

1DF !d. ;"enM1e,MFormMInstance Trigger at Form $evel B GI1 & T=;I1D/;=#./# .T69 forms=mdi=,indo,+ ;I1D/;=&T5T + M5XIMIZ :F & T=;I1D/;=#./# .T69 forms=mdi=,indo,+ TIT$ + E&ummit &porting Goods 5pplicationE:F 1DF

Shik Mahamood Ali

58

Example $(is code could *e used i) a 5!EN6NE56F<-46INS$"NCE tri00er to i)itially ?o?ulate t(e (ierarc(ical tree /it( data. $(e e>am?le locates t(e (ierarc(ical tree 'irst. $(e)1 a record 0rou? is created a)d t(e (ierarc(ical tree is ?o?ulated. #EC8"-E (tree I$E4; @_i0)ore N,4BE-; r0_em?s -EC<-#G-<,7; BEGIN (tree := Fi)d_Item( tree_*lock.(treeS ); r0_em?s := Create_Grou?_From_+uery( r0_em?s 1:select G1 le@el1 e)ame1 N,881 to_c(ar(em?)o) : ;; 'rom em? ;; co))ect *y ?rior em?)o = m0r ;;:start /it( No* = ::7-ESI#EN$:::); @_i0)ore := 7o?ulate_Grou?(r0_em?s); Ftree.Set_$ree_7ro?erty((tree1 Ftree.-EC<-#_G-<,71 r0_em?s); EN#;

2. When-5e,-Block- nstance
#erform an action immediately after t"e input focus moves to an item in a bloc2 ot"er t"an t"e bloc2 t"at previously "ad input focus. Usa7 Not s! Use a ;"enB1e,BBloc2BInstance trigger to perform an action every time /racle Forms instantiates a ne, bloc2. Example $(e 'ollo/i)0 e>am?le o' a 5(e)6Ne/6Block6I)sta)ce tri00er co)ditio)ally sets t(e #E8E$E "88<5E# ?ro?erty to F"8SE. IF GE$_"778IC"$I<N_7-<7E-$.(user)ame) = :SC<$$: $!EN SE$_B8<CQ_7-<7E-$.(:S_I$E4:1#E8E$E_"88<5E#1 7-<7E-$._F"8SE); EN# IF;

3. When-5e,-Record- nstance
#erform an action immediately after t"e input focus moves to an item in a different record. If t"e ne, record is in a different bloc2+ fires after t"e ;"enM1e,MBloc2MInstance trigger+ but before t"e ;"enM1e,MItemMInstance trigger.
Usa7 Not s!

Use a ;"enB1e,B.ecordBInstance trigger to perform an action every time /racle Forms instantiates a ne, record. For example+ ,"en an operator presses RDo,nS to scroll t"roug" a set of records+ /racle Forms fires t"is trigger eac" time t"e input focus moves to t"e next record+ in ot"er ,ords+ eac" time /racle Forms instantiates a ne, record in t"e bloc2.

xample T"e )ursor arrives in eac" record of t"e &=Item bloc2+ and populates t"e product=image item ,it" a picture of t"e products+ if one exists !S #eclare File)ame @arc(arE(EO); Be0i)

Shik Mahamood Ali 59 File)ame:=0et_?roduct_ima0e(:S_I$E4.7-<#,C$_I#); I' File)ame= 9 No 'ile: t(e) Null; Else -ead_Ima0e_File('ile)ame1:ti'':1:S_I$E4.?roduct_ima0e:); E)d i' E)d;
EJ G.a E>am?le: Bri)0s u? t(e de*u00i)0 /i)do/ 'or a ?articular && @alue o' t(e :=<B: item a)ytime t(e user c(a)0es records.&% BEGIN IF :Em?.=o* = :C8E-Q: $!EN Break; Call_Form(:clerk_times(eet:); Break; EN# IF; EN#;

S.J

BEGIN IF (:0lo*al.ca)cel_Iuery = . a)d :system.mode = EN$E-6+,E-. ) $!EN E>it_Form; :0lo*al.ca)cel_Iuery = N ; EN# IF; EN#;

4.When-5e,- tem- nstance


Fires ,"en t"e input focus moves to an item. &pecifically+ it fires after navigation to an item+ ,"en Form Builder is ready to accept input in an item t"at is different t"an t"e item t"at previously "ad input focus. #erform an action immediately after t"e input focus moves to a different item. If t"e ne, item is in a different bloc2+ fires after t"e ;"enM1e,MBloc2MInstance trigger. Usage Notes ,se a 5(e)6Ne/6Item6I)sta)ce tri00er to ?er'orm a) actio) /(e)e@er a) item 0ets i)?ut 'ocus. $(e 5(e)6 Ne/6Item6I)sta)ce tri00er is es?ecially use'ul 'or calli)0 restricted ()a@i0atio)al) *uilt6i)s. GJ IF C!ECQB<B_C!ECQE#(:S_<-#.order_'illed:)$!EN SE$_I$E4_7-<7E-$.(:S_<-#.date_s(i??ed:1,7#"$E_"88<5E#1 ?ro?erty_true); G<_I$E4(:S_<-#.date_s(i??ed:); EN# IF; BuiltCi): C8E"-_I$E4 6 E>am?le: Clear t(e curre)t item i' it does )ot re?rese)t && t(e 'irst day o' a mo)t(. BEGIN IF $<_C!"-(:Em?.!iredate1:##:) 23 :OG: $!EN Clear_Item; 4essa0e(:$(is date must *e o' t(e 'orm OGC4<NC..:); EN# IF;

EJ

EN#; SJ.

BEGIN IF :Em?.Em?)o IS N<$ N,88 $!EN :Glo*al.Em?loyee_Id := :Em?.Em?)o; Clear_Block(No_Validate); EN# IF;

Shik Mahamood Ali EN#;

60

TJ. "ssume t(at you /a)t <racle Forms to dis?lay a) 8<V /(e) t(e o?erator e)ters Iuery mode a)d t(e i)?ut 'ocus is i) a ?articular te>t item. $(e 'ollo/i)0 tri00er accom?lis(es t(at o?eratio).

BEGIN IF :System.Cursor_Item = :E47.E47N<: a)d :System.4ode = :EN$E-C+,E-.: $!EN IF N<$ S(o/_8o@(:my_lo@:) $!EN -"ISE Form_$ri00er_Failure; E)d i'; EN# IF;

EN#;

-, )#LID#TION TRI11ERS >alidation triggers fire ,"en Form Builder validates data in an item or record. Form Builder performs validation c"ec2s during navigation t"at occurs in response to operator input+ programmatic control+ or default processing+ suc" as a )ommit operation.
>alidation occurs at item+ record+ bloc2+ and form levels. Q >alidation "appens ,"en4 B R nterS Dey or 1T . builtMin is activated B )ontrol leaves t"e validation unit due to navigation or commit >alidation #rocess Form Builder performs a validation process at several levels to ensure t"at records and individual values follo, appropriate rules. If validation fails+ t"en control is passed bac2 to t"e appropriate level+ so t"at t"e operator can ma2e corrections. >alidation occurs at4 Q Item level4 Form Builder records a status for eac" item to determine ,"et"er it is currently valid. If an item "as been c"anged and is not yet mar2ed as valid+ t"en Form Builder first performs standard validation c"ec2s to ensure t"at t"e value conforms to t"e itemEs properties. T"ese c"ec2s are carried out before firing any ;"enM>alidateMItem triggers t"at you "ave defined. &tandard c"ec2s include t"e follo,ing4 M Format mas2 M .e*uired 9if so+ t"en is t"e item nullP: M Data type M .ange 9$o,estMGig"est 5llo,ed >alue: M >alidate from $ist 9see later in t"is lesson: Q .ecord level4 5fter leaving a record+ Form Builder c"ec2s to see ,"et"er t"e record is valid. If not+ t"en t"e status of eac" item in t"e record is c"ec2ed+ and a ;"enM>alidateM.ecord trigger is t"en fired+ if present. ;"en t"e record passes t"ese c"ec2s+ it is set to valid. Q Bloc2 and form level4 5t bloc2 or form level+ all records belo, t"at level are validated. For example+ if you commit 9save: c"anges in t"e form+ t"en all records in t"e form are validated+ unless you "ave suppressed t"is action. ;"en Does >alidation /ccurP Form Builder carries out validation for t"e validation unit under t"e follo,ing conditions4 Q T"e R nterS 2ey is 9 1T . command is not necessary mapped to t"e 2ey t"at is p"ysically labeled nter: pressed or t"e 1T . builtMin procedure is run 9,"ose purpose is to force validation immediately:.

Shik Mahamood Ali

61

Q T"e operator or a trigger navigates out of t"e validation unit. T"is includes ,"en c"anges are committed. T"e default validation unit is item+ but can also be set to record+ bloc2+ or form by t"e designer. T"e validation unit is discussed in t"e next section.

Using $/>s for >alidation ;"en you attac" an $/> to a text item by setting t"e $/> property of t"e item+ you can optionally use t"e $/> contents to validate data entered in t"e item. Do t"is by setting t"e >alidate from $ist property to 6es for t"e item. 5t validation time+ Form Builder t"en automatically uses t"e item value as a non caseMsensitive searc" string on t"e $/> contents. T"e follo,ing events t"en occur+ depending on t"e circumstances4 Q If t"e value in t"e text item matc"es one of t"e values in t"e first column of t"e $/>+ validation succeeds+ t"e $/> is not displayed+ and processing continues normally. Q If t"e itemEs value causes a single record to be found in t"e $/>+ but is a partial value of t"e $/> value+ t"en t"e full $/> column value is returned to t"e item 9providing t"at t"e item is defined as t"e return item in t"e $/>:. T"e item t"en passes t"is validation p"ase. Q If t"e item value causes multiple records to be found in t"e $/>+ Form Builder displays t"e $/> and uses t"e text item value as t"e searc" criteria to automatically reduce t"e list+ so t"at t"e operator must c"oose. Q If no matc" is found+ t"en t"e full $/> contents are displayed to t"e operator. >alidation Triggers Q Item level ;"enM>alidateMItem Q Bloc2 level ;"enM>alidateM.ecord

1.

!e" # $%l&d%te -Item

Fires during t"e >alidate t"e Item process. &pecifically+ it fires as t"e last part of item validation for items ,it" t"e 1e, or )"anged validation status. Usa7 Not s

Use a ;"enM>alidateMItem trigger to supplement Form Builder default item validation processing. It is possible to ,rite a ;"enM>alidateMItem trigger t"at c"anges t"e value of an item t"at Form Builder is validating. If validation succeeds+ Form Builder mar2s t"e c"anged item as >alid and does not reMvalidate it. ;"ile t"is be"avior is necessary to avoid validation loops+ it does ma2e it possible for your application to commit an invalid value to t"e database. T"e Defer=.e*uired= nforcement property postpones enforcement of t"e .e*uired property from item validation to record validation. ;"en an item "as t"e .e*uired property set to 6es+ by default Form Builder ,ill not allo, navigation out of t"e item until a valid value is entered. &etting t"e Defer=.e*uired= nforcement property to 6es allo,s t"e operator to move freely among t"e items in t"e record.

;"enM>alidateMItem Trigger 6ou "ave already used t"is trigger to add itemMlevel validation. T"e trigger fires after standard item validation+ and input focus is returned to t"e item if t"e trigger fails.

xample $(e SE8EC$...IN$< stateme)t must retur) a) error i' more t(a) o)e ro/ is retrie@ed t(at matc(es t(e criteria. $(is im?lies 78%S+8 may attem?t to 'etc( data t/ice 'rom t(e ta*le i) Iuestio) to i)sure t(at t(ere are) t t/o matc(i)0 ro/s.

Shik Mahamood Ali 62 BEGIN SE8EC$ descri?tio) IN$< :Em?loyee.Comm?la)_#esc F-<4 comm?la) 5!E-E commcode = :Em?loyee.Commcode; EBCE7$I<N 5!EN No.#ata_Fou)d $!EN 4essa0e( I)@alid Commissio) 7la)1 ,se 28ist3 'or (el? ); -"ISE Form_$ri00er_Failure; 5!EN $oo_4a)y_-o/s $!EN 4essa0e( Error. #u?licate e)tries i) C<4478"N ta*leU ); -"ISE Form_$ri00er_Failure; EN#; 2. !e" # $%l&d%te -Record

Fires during t"e >alidate t"e .ecord process. &pecifically+ it fires as t"e last part of record validation for records ,it" t"e 1e, or )"anged validation status. Use a ;"enM>alidateM.ecord trigger to supplement Form Builder default record validation processing. 1ote t"at it is possible to ,rite a ;"enM>alidateM.ecord trigger t"at c"anges t"e value of an item in t"e record t"at Form Builder is validating. If validation succeeds+ Form Builder mar2s t"e record and all of t"e fields as >alid and does not reMvalidate. ;"ile t"is be"avior is necessary to avoid validation loops+ it does ma2e it possible for your application to commit an invalid value to t"e database.
;"enM>alidateM.ecord Trigger T"is trigger fires after standard recordMlevel validation+ ,"en t"e operator "as left a ne, or c"anged record. Because Form Builder "as already c"ec2ed t"at re*uired items for t"e record are valid+ you can use t"is trigger to perform additional c"ec2s t"at may involve more t"an one of t"e recordEs items+ in t"e order t"ey ,ere entered. ;"enM>alidateM.ecord must be defined at bloc2 level or above.

Example $(e 'ollo/i)0 e>am?le @eri'ies t(at Start_#ate is less t(a) E)d_#ate. Si)ce t(ese t/o te>t items (a@e @alues t(at are related1 it s more co)@e)ie)t to c(eck t(e com*i)atio) o' t(em o)ce at t(e record le@el1 rat(er t(a) c(eck eac( item se?arately. $(is code ?resumes *ot( date items are ma)datory a)d t(at )eit(er /ill *e N,88. %& 4et(od G: !ardcode t(e item )ames i)to t(e tri00er. && Structured t(is /ay1 t(e c(a)ce t(is code /ill && *e reusa*le i) ot(er 'orms /e /rite is ?retty lo/ *ecause o' de?e)de)cy o) *lock a)d item && )ames.&% BEGIN IF :E>?erime)t.Start_#ate 3 :E>?erime)t.E)d_#ate $!EN 4essa0e( .our date ra)0e e)ds *e'ore it startsU ); -"ISE Form_$ri00er_Failure; EN# IF; EN#; I,TR#NS#CTION#L TRI11ERS Transactional triggers fire in response to a ,ide variety of events t"at occur as a form interacts ,it" t"e data source.
Transaction processing includes t,o p"ases4 Q #ost4 B ;rites record c"anges to base tables B Fires transactional triggers Q )ommit4 #erforms database commit rrors result in4

Shik Mahamood Ali


Q .ollbac2 of t"e database c"anges Q rror message T"e )ommit &e*uence of vents

63

T"e commit se*uence of events 9,"en t"e 5rray DM$ si7e is !: is as follo,s4 ! >alidate t"e form. ( #rocess save point. - Fire t"e #reM)ommit trigger. 3 >alidate t"e bloc2 9for all bloc2s in se*uential order:. For all deleted records of t"e bloc2 9in reverse order of deletion:4 M Fire t"e #reMDelete trigger. M Delete t"e ro, from t"e base table or fire t"e /nMDelete trigger. M Fire t"e #ostMDelete trigger. For all inserted or updated records of t"e bloc2 in se*uential order4 If it is an inserted record4 M )opy >alue From Item. M Fire t"e #reMInsert trigger. M )"ec2 t"e record uni*ueness. M Insert t"e ro, into t"e base table or fire t"e /nMInsert trigger. M Fire t"e #ostMInsert trigger. If it is an updated record4 M M M M Fire t"e #reMUpdate trigger. )"ec2 t"e record uni*ueness Update t"e ro, in t"e base table or fire t"e /nMUpdate trigger. Fire t"e #ostMUpdate trigger.

8 Fire t"e #ostMFormsM)ommit trigger. If t"e current operation is )/MMIT+ t"en4 < Issue an &'$M)/MMIT statement. ? Fire t"e #ostMDatabaseM)ommit trigger.

Commit $ri00ers ,ses "# $re-%ommit


)"ec2 user aut"ori7ationF set up special loc2ing #reM)ommit Fires once during commit processing+ before base table bloc2s are processedF fires if t"ere are c"anges to base table items in t"e form or if c"anges "ave been posted but not yet committed 9T"is trigger al,ays fires in case of uncommitted posts+ even if t"ere are no c"anges to post.: Usa7 Not s!

Use a #reB)ommit trigger to perform an action+ suc" as setting up special loc2ing re*uirements+ anytime a database commit is going to occur. #reM)ommit4 Fires once if form c"anges are made or uncommitted c"anges are posted

&# $re-Delete
TournalingF implement foreignM2ey delete rule

Fires duri)0 t(e 7ost a)d Commit $ra)sactio)s ?rocess1 *e'ore a ro/ is deleted. It 'ires o)ce 'or eac( record t(at is marked 'or delete. Usage Notes ,se a 7re6#elete tri00er to delete t(e detail record o' a master record. ,se a 7re6#elete tri00er to ?re@e)t t(e deletio) o' a record i' t(at record is t(e master record 'or detail records t(at still e>ist.
7-E6#E8E$E $-IGGE- 66 Fi)al c(ecks *e'ore ro/ deletio)

Shik Mahamood Ali


#EC8"-E

64

C,-S<- CG IS SE8EC$ :a)yt(i)0: F-<4 S_<-# 5!E-E customer_id = :S_C,S$<4E-.id; BEGIN <7EN CG; FE$C! CG IN$< :G8<B"8.dummy; IF CGAF<,N# $!EN 4ESS"GE(:$(ere are orders 'or t(is customerU:); -"ISE 'orm_tri00er_'ailure; E8SE C8<SE CG; EN# IF; EN#;

'# $re-Insert Fires during t"e #ost and )ommit Transactions process+ before a ro, is inserted. It fires once for eac" record t"at is mar2ed for insert. Generate se*uence numbersF 0ournalingF automatically generated columnsF c"ec2 constraints
Usa7 Not s! Use a #reBInsert trigger to perform t"e follo,ing tas2s4 c"ange item values 2eep trac2 of t"e date a record is created and store t"at in t"e record prior to committing

Exa'ple:(
$(is 7re6I)sert tri00er o) t(e S_<-# *lock assi0)s a) <rder I# 'rom t(e seIue)ce S_<-#_I#1 /(ic( /ill *e /ritte) to t(e I# colum) /(e) t(e ro/ is su*seIue)tly i)serted. Be0i) SE8EC$ S_<-#_I#.)e>t@al IN$< :S_<-#.id F-<4 S.S.dual; E)d; 1ote4 T"e Insert 5llo,ed and Deyboard 1avigable properties on 4&=/.D.id s"ould be 1o+ so t"at t"e user does not enter an ID manually. 6ou can also assign se*uence numbers from a table. If you use t"is met"od+ t"en t,o transactional triggers are usually involved4

Q Use #reMInsert to select t"e next available number from t"e se*uence table 9loc2ing t"e ro, to prevent ot"er users from selecting t"e same value: and increment t"e value by t"e re*uired amount. Q Use #ostMInsert to update t"e se*uence table+ recording t"e ne, upper value for t"e se*uence.

Exa'ple:)
T"is example assigns a primary 2ey field based on a se*uence number+ and t"en ,rites a ro, into an auditing table+ flagging creation of a ne, order. #EC8"-E C,-S<- )e>t_ord IS SE8EC$ orderid_seI.NEB$V"8 F-<4 dual; BEGIN /* ** Fetch the next se&uence num'er from the ** explicit cursor directl( into the item in ** the Order record. Could use )*+*CT...INTO, ** 'ut explicit cursor is more efficient. */ <7EN )e>t_ord; FE$C! )e>t_ord IN$< :<rder.<rderId; C8<SE )e>t_ord; /* ** Ma-e sure !e populated a ne! order id o-... */ IF :<rder.<rderId IS N,88 $!EN 4essa0e(:Error Ge)erati)0 Ne>t <rder Id:);

Shik Mahamood Ali


-"ISE Form_$ri00er_Failure; EN# IF;

65
/* ** Insert a ro! into the audit ta'le */

INSE-$ IN$< ord_audit( orderid1 o?eratio)1 user)ame1 timestam? ) V"8,ES ( :<rder.<rderId1 :Ne/ <rder:1 ,SE-1S.S#"$E ); EN#;

(# $re-Update Fires during t"e #ost and )ommit Transactions process+ before a ro, is updated. It fires once for eac" record t"at is mar2ed for update. TournalingF implement foreignM2ey update ruleF autoMgenerated columnsF c"ec2 constraints Usa7 Not s! Use a #reBUpdate trigger to audit transactions. Exa'ple: $(e 'ollo/i)0 e>am?le /rites a ro/ i)to a) "udit $a*le s(o/i)0 old discou)t a)d )e/ discou)t 'or a 0i@e) customer1 i)cludi)0 timestam? a)d user)ame maki)0 t(e c(a)0e. #EC8"-E old_discou)t N,4BE-; )e/_discou)t N,4BE- := :Customer.#iscou)t_7ct; o?er_desc V"-C!"-E(RO); C,-S<- old_@alue IS SE8EC$ discou)t_?ct F-<4 customer 5!E-E CustId = :Customer.CustId; BEGIN %& && Fetc( t(e old @alue o' discou)t ?erce)ta0e 'rom t(e data*ase *y CustomerId. 5e )eed to do t(is si)ce t(e @alue o' :Customer.#iscou)t_7ct /ill *e t(e &)e/& @alue /e:re 0etti)0 ready to commit a)d /e /a)t to record 'or ?osterity t(e old a)d )e/ @alues. 5e could use SE8EC$...IN$< *ut c(oose a) e>?licit cursor 'or e''icie)cy. &% <7EN old_@alue; FE$C! old_@alue IN$< old_discou)t; C8<SE old_@alue; %& && I' t(e old a)d curre)t @alues are di''ere)t1 t(e) /e )eed to /rite out a) audit record &% IF old_discou)t 23 )e/_discou)t $!EN %& Co)struct a stri)0 t(at s(o/s t(e o?eratio) o' C(a)0i)0 t(e old @alue to t(e )e/ @alue. e.0. && :C(a)0ed #iscou)t 'rom GS.VA to EOA: &% o?er_desc := :C(a)0ed #iscou)t 'rom :;; $<_C!"-(old_discou)t);;:A to :;; $<_C!"-()e/_discou)t);;:A:; %& && I)sert t(e audit record /it( timestam? a)d user &% INSE-$ IN$< cust_audit( custid1 o?eratio)1 user)ame1 timestam? ) V"8,ES ( :Customer.CustId1o?er_desc1,SE-1S.S#"$E ); EN# IF; EN#;

)# *n-%ommit

Shik Mahamood Ali 66 Fires ,"enever /racle Forms ,ould normally issue a database commit statement to finali7e a transaction. By default+ t"is operation occurs after all records t"at "ave been mar2ed as updates+ inserts+ and deletes "ave been posted to t"e database. Usage Notes: Use an /nB)ommit trigger to c"ange t"e conditions of normal /racle Forms commit processing to fit t"e particular re*uirements of a commit to a nonB/.5)$ database. To perform t"e default processing from t"is trigger+ call to t"e )/MMIT=F/.M builtBin. Example: $(is e>am?le disa*les t(e commit o?eratio) /(e) ru))i)0 a0ai)st a datasource t(at does )ot su??ort tra)sactio) co)trol. I' t(e a??licatio) is ru))i)0 a0ai)st <-"C8E1 t(e commit o?eratio) *e(a@es )ormally. BEGIN IF Get_"??licatio)_7ro?erty(#"$"_S<,-CE) = :<-"C8E: $!EN Commit_Form; EN# IF; /* ** other!ise, no action is performed */

EN#; +# *n-Delete

Fires during t"e #ost and )ommit Transactions process. &pecifically+ it fires after t"e #reBDelete trigger fires and before t"e #ostBDelete trigger fires+ replacing t"e actual database delete of a given ro,. T"e trigger fires once for eac" ro, t"at is mar2ed for deletion from t"e database.

Usage Notes:
Use an /nBDelete trigger to replace t"e default /racle Forms processing for "andling deleted records during transaction posting. To perform t"e default /racle Forms processing from t"is trigger+ t"at is+ to delete a record from your form or from t"e database+ include a call to t"e D $ T =. )/.D builtBin.

Example: $(is e>am?le u?dates t(e em?loyee ta*le to set t(e $ermi)atio)_#ate1 rat(er t(a) actually deleti)0 t(e em?loyee 'rom t(e data*ase. BEGIN ,7#"$E em? SE$ termi)atio)_date = S.S#"$E 5!E-E em?)o = :Em?.Em?)o; EN#;

,# *n-Insert
Fires during t"e #ost and )ommit Transactions process ,"en a record is inserted. &pecifically+ it fires after t"e #reMInsert trigger fires and before t"e #ostMInsert trigger fires+ ,"en Form Builder ,ould normally insert a record in t"e database. It fires once for eac" ro, t"at is mar2ed for insertion into t"e database.

Usa7

Not s Use an /nMInsert trigger to replace t"e default Form Builder processing for "andling inserted records during transaction posting. To perform t"e default Form Builder processing from t"is trigger+ include a call to t"e I1& .T=. )/.D builtMin.

Description 5(e) called 'rom a) <)6I)sert tri00er1 i)serts t(e curre)t record i)to t(e data*ase duri)0 7ost a)d Commit $ra)sactio)s ?rocessi)0. $(is *uilt6i) is i)cluded ?rimarily 'or a??licatio)s t(at /ill ru) a0ai)st a )o)6 <-"C8E datasource. - ntax

Shik Mahamood Ali 7-<CE#,-E INSE-$_-EC<-#;

67

%& && Built6i): INSE-$_-EC<-# && E>am?le : 7er'orm Form Builder sta)dard i)sert ?rocessi)0 && *ased o) a 0lo*al 'la0 setu? at startu? *y t(e && 'orm1 ?er(a?s *ased o) a ?arameter. && $ri00er: <)6I)sert &% BEGIN %& && C(eck t(e 0lo*al 'la0 /e setu? at 'orm startu? &% IF :Glo*al.,si)0_$ra)sactio)al_$ri00ers = $-,E $!EN ,ser_E>it( my_i)srec *lock=E47 ); %& && <t(er/ise1 do t(e ri0(t t(i)0. &% E8SE I)sert_-ecord; EN# IF; EN#; .# *n-Update
Fires during t"e #ost and )ommit Transactions process. &pecifically+ it fires after t"e #reBUpdate trigger fires and before t"e #ostBUpdate trigger fires+ ,"en /racle Forms ,ould normally update a record in t"e database. It fires once for eac" ro, t"at is mar2ed for update in t"e form. Usage 1otes4 Use an /nBUpdate trigger to replace t"e default /racle Forms processing for "andling updated records during transaction posting. To perform t"e default /racle Forms processing from t"is trigger+ include a call to t"e U#D5T =. )/.D builtBin.

Be0i) ,7#"$E -EC<-#; E)d; 5(e) called 'rom a) <)6,?date tri00er1 i)itiates t(e de'ault Form Builder ?rocessi)0 'or u?dati)0 a record i) t(e data*ase duri)0 t(e 7ost a)d Commit $ra)sactio) ?rocess. $(is *uilt6i) is i)cluded ?rimarily 'or a??licatio)s t(at ru) a0ai)st a )o)6<-"C8E data source.

#48 Stateme)ts Issued #uri)0 Commit 7rocessi)0 INSE-$ IN$< *ase_ta*le ( *ase_colum)1 *ase_colum)1...) V"8,ES ( :*ase_item1 :*ase_item1 ...) ,7#"$E *ase_ta*le SE$ *ase_colum) = :*ase_item1 *ase_colum) = :*ase_item1 ...5!E-E -<5I# = :-<5I# #E8E$E F-<4 *ase_ta*le 5!E-E -<5I# = :-<5I# DM$ &tatements Issued During )ommit #rocessing .ules4 Q DM$ statements may fire database triggers. Q Form Builder uses and retrieves ./;ID. Q T"e Update )"anged )olumns /nly and nforce )olumn &ecurity properties affect U#D5T statements. Q $oc2ing statements are not issued.

/# $ost 0 Database %ommit Description

Shik Mahamood Ali

68

Fires once during t"e #ost and )ommit Transactions process+ after t"e database commit occurs. 1ote t"at t"e #ostMFormsM)ommit trigger fires after inserts+ updates+ and deletes "ave been posted to t"e database+ but before t"e transaction "as been finali7ed by issuing t"e )ommit. T"e #ostMDatabaseM )ommit Trigger fires after Form Builder issues t"e )ommit to finali7e t"e transaction.

Usage Notes ,se a 7ost6#ata*ase6Commit tri00er to ?er'orm a) actio) a)ytime a data*ase commit (as occurred. Example
%& && F,NC$I<N recs_?osted_a)d_)ot_committed && -E$,-N B<<8E"N IS BEGIN #e'ault_Value( $-,E 1 Glo*al.#id_#B_Commit ); -E$,-N (:System.Form_Status = +,E-. "N# :Glo*al.#id_#B_Commit = F"8SE ); EN#; &% BEGIN :Glo*al.#id_#B_Commit := F"8SE ; EN#; #ostMDatabaseM)ommit Determines if commit ,as successfulF determines if t"ere are posted+ uncommitted c"anges

"1# $ost 0 Form - %ommit


Fires once during t"e #ost and )ommit Transactions process. If t"ere are records in t"e form t"at "ave been mar2ed as inserts+ updates+ or deletes+ t"e #ostMFormsM)ommit trigger fires after t"ese c"anges "ave been ,ritten to t"e database but before Form Builder issues t"e database )ommit to finali7e t"e transaction. If t"e operator or t"e application initiates a )ommit ,"en t"ere are no records in t"e form "ave been mar2ed as inserts+ updates+ or deletes+ Form Builder fires t"e #ostMFormsM)ommit trigger immediately+ ,it"out posting c"anges to t"e database.

Usage Notes ,se a 7ost6Forms6Commit tri00er to ?er'orm a) actio)1 suc( as u?dati)0 a) audit trail1 a)ytime a data*ase commit is a*out to occur. 7ost6Forms6Commit C(ecks com?le> multiro/ co)strai)ts

Example $(is e>am?le ca) *e used i) co)cert /it( t(e 7ost6#ata*ase6Commit tri00er to detect i' records (a@e *ee) ?osted *ut )ot yet committed. B; @!-'+I?- recs_posted_and_not_committed *$+!*- B??($)- IS B$>I&efa%lt_/al%e(6+*!$6 6>lobal.&id_&B_'ommit6)# *$+!*- (4System.@orm_Stat%s 5 6C!$*D6)-& 4>lobal.&id_&B_'ommit 5 @)(S$6)# $-&# ;B B$>I4>lobal.&id_&B_'ommit 45 6@)(S$6# $-&# ""# $ost 0 Delete Fires during t"e #ost and )ommit Transactions process+ after a ro, is deleted. It fires once for eac" ro, t"at is deleted from t"e database during t"e commit process. form or bloc2

Shik Mahamood Ali

69

Usage 1otes4 Use a #ostBDelete trigger to audit transactions.


E>am?le 6 G Be0i) INSE-$ IN$< delete_audit (id1 timestam?1 /(o_did_it)V"8,ES ( :S_<-#.id1 S.S#"$E1 ,SE- );

E)d;

E>am?le 6 E Be0i) #elete 'rom S_<-# SE$ 5!E-E id = :S_<-#.id; IF S+8AN<$F<,N# $!EN 4ESS"GE(:-ecord )ot 'ou)d i) data*ase:); -"ISE 'orm_tri00er_'ailure; Else 4essa'e(S+8Aro/cou)t;; L ro/s #eletedM); EN# IF; E)d;

"&# $ost 0 Insert Fires during t"e #ost and )ommit Transactions process+ 0ust after a record is inserted. It fires once for eac" record t"at is inserted into t"e database during t"e commit process.
Use a #ostMInsert trigger to audit transactions. ;rite c"anges to nonbase tables. Gat"er statistics on applied c"anges.

Exa'ple (
Deeping an 5udit Trail 4G$/B5$.insert=tot 4K T/=)G5.9T/=1UMB .94G$/B5$.insert=tot:[!:F

Exa'ple )
$o (a)dle e>ce?tio)s1 i)clude EBCE7$I<N sectio) i) tri00er. 7ost6I)sert tri00er: Be0i) INSE-$ IN$< 8<G_$"B (8<G_V"81 8<G_,SE-) V"8,ES(:S_#E7$.id1:G8<B"8.user)ame); EBCE7$I<N 5!EN <$!E-S $!EN 4ESS"GE(:ErrorU :1;;S+8E--4); E)d;

"'# $ost 0 Update Fires during t"e #ost and )ommit Transactions process+ after a ro, is updated. It fires once for eac" ro, t"at is updated in t"e database during t"e commit process. Usa7 Not s! Use a #ostBUpdate trigger to audit transactions.

$(is 7ost6,?date tri00er /rites t(e curre)t record I# to t(e ,7#"$E_",#I$ ta*le1alo)0 /it( a time stam? a)d t(e user /(o ?er'ormed t(e u?date.

Shik Mahamood Ali


E>am?le 6 G Be0i)

70

E)d;

INSE-$ IN$< u?date_audit (id1 timestam?1 /(o_did_it)V"8,ES ( :S_<-#.id1 S.S#"$E1 ,SE- );

E>am?le 6 E Be0i) ,7#"$E S_<-# SE$ date_s(i??ed = S.S#"$E 5!E-E id = :S_<-#.id; IF S+8AN<$F<,N# $!EN 4ESS"GE(:-ecord )ot 'ou)d i) data*ase:); -"ISE 'orm_tri00er_'ailure; EN# IF; E)d;

+uery 7rocessi)0 $ri00ers ,ses "(# $re 0 -elect


Fires during xecute 'uery and )ount 'uery processing+ after Form Builder constructs t"e & $ )T statement to be issued+ but before t"e statement is actually issued. 1ote t"at t"e & $ )T statement can be examined in a #reM&elect trigger by reading t"e value of t"e system variable &6&T M.$5&T='U .6 Fires after Form Builder "as constructed t"e bloc2 & $ )T statement based on t"e *uery conditions+ but before it issues t"is statement Use a #reM&elect trigger to prepare a *uery prior to execution against a nonM/.5)$ data source. $(is e>am?le assi0)s a ?rimary key 'ield *ased o) a seIue)ce )um*er1 a)d t(e) /rites a ro/ i)to a) auditi)0 ta*le1 'la00i)0 creatio) o' a )e/order.

#EC8"-E C,-S<- )e>t_ord IS SE8EC$ orderid_seI.NEB$V"8 F-<4 dual; BEGIN %&& Fetc( t(e )e>t seIue)ce )um*er 'rom t(e E>?licit cursor directly i)to t(e item i) t(e <rder record. Could use SE8EC$...IN$<1 && *ut e>?licit cursor is more e''icie)t. &% <7EN )e>t_ord; FE$C! )e>t_ord IN$< :<rder.<rderId; C8<SE )e>t_ord; IF :<rder.<rderId IS N,88 $!EN 4essa0e(:Error Ge)erati)0 Ne>t <rder Id:); -"ISE Form_$ri00er_Failure; EN# IF; /** Insert a ro! into the audit ta'le INSE-$ IN$< ord_audit( orderid1 o?eratio)1 user)ame1 timestam? ) V"8,ES ( :<rder.<rderId1:Ne/ <rder:1,SE-1S.S#"$E ); EN#;

")# *n - -elect Fires ,"en Form Builder ,ould normally execute t"e open cursor+ parse+ and execute p"ases of a *uery+ to identify t"e records in t"e database t"at matc" t"e current *uery criteria. /nM&elect replaces open cursor+ parse+ and execute p"ases. Usage Notes
Use an /nM&elect trigger to open and execute t"e database cursor. &pecifically+ use t"is trigger ,"en you are retrieving data from a nonM/.5)$ data source. T"e /nM&elect trigger can be used in con0unction ,it" t"e /nMFetc" trigger to replace t"e processing t"at normally occurs in t"e X )UT ='U .6 builtMin subprogram.

Shik Mahamood Ali

71

To perform t"e default Form Builder processing from t"is trigger+ include a call to t"e & $ )T=. )/.D& builtMin.

Exa'ple - (
I) t(e 'ollo/i)0 e>am?le1 t(e <)6Select tri00er is used to call a user e>it1 +uery1 a)d a *uilt6i) su*?ro0ram1 SE8EC$_-EC<-#S1 to ?er'orm a Iuery a0ai)st a data*ase. Be0i) IF Get_"??licatio)_7ro?erty(#"$"S<,-CE) = #BE $!EN ,ser_E>it ( +uery ); IF Form_Failure <- Form_Fatal $!EN "B<-$_+,E-.; EN# IF; E8SE %& && 7er'orm t(e de'ault Form Builder task o' o?e)i)0 t(e Iuery. &% Select_-ecords; EN# IF; E)d;

"+# $ost--elect 2rigger Description Fires after Form Builder "as constructed and issued t"e bloc2 & $ )T statement+ but before it fetc"es t"e records T"e #ostM&elect trigger fires after t"e default selection p"ase of *uery processing+ or after t"e successful execution of t"e /nM&elect trigger. It fires before any records are actually retrieved t"roug" fetc" processing.

Usage Note: ,se t(e 7ost6Select tri00er to ?er'orm a) actio) *ased o) t(e outcome o' t(e Select ?(ase o' Iuery ?rocessi)0 suc( as a) actio) *ased o) t(e )um*er o' records t(at matc( t(e Iuery criteria. ")# *n 0 Fetch Fires ,"en Form Builder performs a fetc" for a set of ro,s 96ou can use t"e ). 5T ='U .I D=. )/.D builtMin to create *ueried records if you ,ant to replace default fetc" processing.: H <)6Fetc( co)ti)ues to 'ire u)til: C It 'ires /it(out e>ecuti)0 C-E"$E_+,E-IE#_-EC<-#. C $(e Iuery is closed *y t(e user or *y "B<-$_+,E-.. C It raises F<-4_$-IGGE-_F"I8,-E.
$(e tri00er /ill 'ire o)ce 'or eac( record t(at is to *e 'etc(ed. <)CFetc(:

#EC8"-E N N,4BE- := Get_Block_7ro?erty(*lk_)ame1 -EC<-#S_$<_FE$C!); em?ro/ em?A-<5$.7E; BEGIN F<- ctr IN G..N 8<<7 %& && $ry to 0et t(e )e>t ro/. &%

EBI$ 5!EN N<$ 4y7acka0e.Get_Ne>t_-o/(em?ro/); Create_+ueried_-ecord;

Shik Mahamood Ali

72 :Em?.ro/id := em?ro/.-<5I#; :Em?.em?)o := em?ro/.E47N<; :Em?.e)ame := em?ro/.EN"4E; EN# 8<<7; IF 'orm_'atal <- 'orm_'ailure $!EN raise 'orm_tri00er_'ailure; EN# IF;

EN#;

"+# *n 0 %ount Fires ,"en Form Builder ,ould usually perform default )ount 'uery processing to determine t"e number of ro,s t"at matc" t"e *uery conditions Fires ,"en Form Builder ,ould normally perform default )ount 'uery processing to determine t"e number of ro,s in t"e database t"at matc" t"e current *uery criteria. ;"en t"e /nM)ount trigger completes execution+ Form Builder issues t"e standard *uery "its message4 FRM-'F&GG! +u r. ?ill r tri 9 HnI r /or8s,

Usage Notes ,se a) <)6Cou)t tri00er to re?lace de'ault Cou)t +uery ?rocessi)0 i) a) a??licatio) ru))i)0 a0ai)st a )o)6<-"C8E data source. $o ?er'orm t(e de'ault Form Builder ?rocessi)0 'rom t(is tri00er1 i)clude a call to t(e *uilt6i). I' you are re?laci)0 de'ault ?rocessi)01 you ca) set t(e @alue o' t(e +uery_!its *lock ?ro?erty to i)dicate t(e )um*er o' records i) t(e )o)6<-"C8E data source t(at matc( t(e Iuery criteria. Form Builder /ill dis?lay t(e Iuery (its messa0e (F-46TOSVV) e@e) i' t(e <)6Cou)t tri00er 'ails to set t(e @alue o' t(e +uery_!its *lock ?ro?erty. I) suc( a case1 t(e messa0e re?orts O records ide)ti'ied. Example - " $(is e>am?le calls a user6)amed su*?ro0ram to cou)t t(e )um*er o' records to *e retrie@ed *y t(e curre)t Iuery criteria1 a)d sets t(e +uery_!its ?ro?erty a??ro?riately. #EC8"-E N N,4BE-; BEGIN N := -ecs_-etur)ed( #E7$ 1Name_I)( #E7$.#N"4E )); Set_Block_7ro?erty( #E7$ 1+,E-._!I$S1N); EN#; Example & %& && Built6i): C<,N$_+,E-. && E>am?le: #is?lay t(e )um*er o' records t(at /ill *e retrie@ed && *y t(e curre)t Iuery. &% BEGIN EN#; Cou)t_+uery;

Shik Mahamood Ali 73 Example ' %& && Built6i): C<,N$_+,E-. && E>am?le: 7er'orm Form Builder cou)t Iuery (its ?rocessi)0. #ecide /(et(er to use t(is Built6i) or a user && e>it *ased o) a 0lo*al 'la0 setu? at startu? *y t(e 'orm1 ?er(a?s *ased o) a ?arameter. & $ri00er: <)6Cou)t &% BEGIN /* ** Chec- the glo'al flag !e set during form startup */ IF :Glo*al.,si)0_$ra)sactio)al_$ri00ers = $-,E $!EN /* ** .ser exit returns &uer( hits count 'ac- into the ** CONTRO+./IT) item. */ ,ser_E>it( my_cou)t ); /* ** 0eposit the num'er of &uer( hits in the appropriate ** 'loc- propert( so Form 1uilder can displa( its normal ** status message. */ Set_Block_7ro?erty(:System.$ri00er_Block1+,E-._!I$S1:co)trol.(its); /* ** Other!ise, do the right thing. */ E8SE Cou)t_+uery; EN# IF; EN#; ",#*n--equence-Number 2rigger Description Fires ,"en Form Builder ,ould normally perform t"e default processing for generating se*uence numbers for default item values. .eplaces t"e default series of events t"at occurs ,"en Form Builder interacts ,it" t"e database to get t"e next value from a & 'U 1) ob0ect defined in t"e database. Usage Notes ;"en a & 'U 1) is used as a default item value+ Form Builder *ueries t"e database to get t"e next value from t"e & 'U 1) ,"enever t"e )reate .ecord event occurs. &uppress or override t"is functionality ,it" an /nM&e*uenceM1umber trigger. To perform t"e default Form Builder processing from t"is trigger+ call t"e G 1 .5T =& 'U 1) =1UMB . builtMin.

Exa'ple: %& && BuiltCi): GENE-"$E_SE+,ENCE_N,4BE&& E>am?le: 7er'orm <racle Forms sta)dard seIue)ce )um*er ?rocessi)0 *ased o) a 0lo*al 'la0 setu? at && startu? *y t(e 'orm1 ?er(a?s *ased o) a ?arameter. && $ri00er: <)CSeIue)ceCNum*er &% BEGIN /* ** Chec- the glo'al flag !e setup at form startup */

Shik Mahamood Ali 74 IF :Glo*al.,si)0_$ra)sactio)al_$ri00ers = :$-,E: $!EN ,ser_E>it(:my_seI)um seI=E47N<_SE+:); /* ** Other!ise, do the right thing. */ E8SE Ge)erate_SeIue)ce_Num*er;

EN# IF; EN#; ".# *n-%hec3-Unique 2rigger Description During a commit operation+ t"e /nM)"ec2MUni*ue trigger fires ,"en Form Builder normally c"ec2s t"at primary 2ey values are uni*ue before inserting or updating a record in a base table. It fires once for eac" record t"at "as been inserted or updated. .eplaces t"e default processing for c"ec2ing record uni*ueness. ;"en a bloc2 "as t"e #.IMD 6B property set to 6es+ Form Builder+ by default+ c"ec2s t"e uni*ueness of a record by constructing and executing t"e appropriate &'$ statement to select for ro,s t"at matc" t"e current recordUs primary 2ey values. If a duplicate ro, is found+ Form Builder displays message FRM-'FJFF! R /or8 =as alr a8. 0 n ins rt 8, For a record t"at "as been mar2ed for insert+ Form Builder al,ays c"ec2s for uni*ue primary 2ey values. In t"e case of an update+ Form Builder c"ec2s for uni*ue primary 2ey values only if one or more items t"at "ave t"e #rimary Dey item property "ave been modified. Usa7 Not s To perform t"e default processing from t"is trigger+ call t"e )G )D=. )/.D=U1I'U 1 && builtMin. *n-%hec3-Unique 2rigger examples $(e 'ollo/i)0 e>am?le @eri'ies t(at t(e curre)t record i) Iuestio) does )ot already e>ist i) t(e #E7$ ta*le. #EC8"-E C,-S<- c(k_u)iIue IS SE8EC$ > F-<4 de?t 5!E-E de?t)o = :de?t.de?t)o; tm? V"-C!"-E(G); BEGIN <7EN c(k_u)iIue; FE$C! c(k_u)iIue IN$< tm?; C8<SE c(k_u)iIue; IF tm? IS N<$ N,88 $!EN 4essa0e( $(is de?artme)t already e>ists. ); -"ISE Form_$ri00er_Failure; EN# IF; EN#; "/# *n-%lose 2rigger D s/ription Fires ,"en an operator or t"e application causes a *uery to close. By default+ Form Builder closes a *uery ,"en all of t"e records identified by t"e *uery criteria "ave been fetc"ed+ or ,"en t"e operator or t"e application aborts t"e *uery.

Shik Mahamood Ali 75 T"e /nM)lose trigger augments t"e normal Form Builder Oclose cursorO p"ase of a *uery. Usa7 Not s Use an /nM)lose trigger after using t"e /nM&elect or /nMFetc" triggers+ specifically+ to close files+ close cursors+ and free memory. T"e /nM)lose trigger fires automatically ,"en t"e 5B/.T='U .6 builtMin is called from an /nM&elect trigger.

Example $(e 'ollo/i)0 e>am?le releases memory *ei)0 used *y a user6de'i)ed data access met(od @ia t(e tra)sactio)al tri00ers. BEGIN IF N<$ my_data source_o?e)( #BGGO_#E7$ ) $!EN my_datasource_close( #BGGO_#E7$ ); EN# IF;

EN#;

&1# *n-%olumn--ecurit 2rigger D s/ription Fires ,"en Form Builder ,ould normally enforce columnMlevel security for eac" bloc2 t"at "as t"e nforce )olumn &ecurity bloc2 property set /n. By default+ Form Builder enforces column security by *uerying t"e database to determine t"e base table columns to ,"ic" t"e current form operator "as update privileges. For columns to ,"ic" t"e operator does not "ave update privileges+ Form Builder ma2es t"e corresponding base table items in t"e form nonMupdateable by setting t"e Update 5llo,ed item property /ff dynamically. Form Builder performs t"is operation at form startup+ processing eac" bloc2 in se*uence. Usa7 Not s To perform t"e default processing from t"is trigger+ call t"e 1F/.) =)/$UM1=& )U.IT6 builtMin. Example $(e 'ollo/i)0 e>am?le sets salary a)d commissio) te>t items i) t(e curre)t *lock to disa*led a)d )o)6u?datea*le1 u)less t(e S,7E-,SE- role is e)a*led. <)ly users /it( t(e user6de'i)ed S,7E-,SE- role ca) c(a)0e t(ese )um*er 'ields. #EC8"-E itm_id Item; o)_or_o'' N,4BE-; BEGIN IF N<$ role_is_set( S,7E-,SE- ) $!EN o)_or_o'' := 7-<7E-$._<FF; E8SE o)_or_o'' := 7-<7E-$._<N; EN# IF; itm_id := Fi)d_Item( Em?.Sal ); Set_Item_7ro?erty(itm_id1EN"B8E#1o)_or_o'');

Shik Mahamood Ali 76 Set_Item_7ro?erty(itm_id1,7#"$E"B8E1o)_or_o''); itm_id := Fi)d_Item( Em?.Comm ); Set_Item_7ro?erty(itm_id1EN"B8E#1o)_or_o''); Set_Item_7ro?erty(itm_id1,7#"$E"B8E1o)_or_o''); EN#; &"# *n-4ollbac3 2rigger D s/ription Fires ,"en Form Builder ,ould normally issue a ./$$B5)D statement+ to roll bac2 a transaction to t"e last savepoint t"at ,as issued. Usa7 Not s

Use an /nM.ollbac2 trigger to replace standard Form Builder rollbac2 processing. To perform default Form Builder processing from t"is trigger+ include a call to t"e I&&U =./$$B5)D builtMin. ISS,E_-<88B"CQ e>am?les %& && Built6i): ISS,E_-<88B"CQ && E>am?le: 7er'orm Form Builder sta)dard -oll*ack ?rocessi)0. && #ecide /(et(er to use t(is *uilt6i) *ased o) a && 0lo*al 'la0 setu? at startu? *y t(e 'orm. && ?er(a?s *ased o) a ?arameter. && $ri00er: <)6-oll*ack &% #EC8"-E s?_)ame V"-C!"-E(RO); BEGIN /* 2et the name of the sa3epoint to !hich Form 1uilder needs to ** roll'ac-. 4N.++ 5 Full Roll'ac-6*/ s?_)ame := Get_"??licatio)_7ro?erty(S"VE7<IN$_N"4E); /* ** Chec- the glo'al flag !e setup at form startup */ IF :Glo*al.,si)0_$ra)sactio)al_$ri00ers = $-,E $!EN ,ser_E>it( my_roll*k )ame= ;;s?_)ame); E8SE Issue_-oll*ack(s?_)ame); EN# IF

; EN#;

J,LO1ON TR#NS#CTION TRI11ERS "# $re-5ogon 2rigger Fires 0ust before Form Builder initiate a logon procedure to t"e data source. Usa7 Not s

Use a #reM$ogon trigger to prepare t"e form for t"e logon procedure+ particularly to a nonM /.5)$ data source. &# *n-5ogon 2rigger <i&es on$e (e& lo)on /hen "&a$le <o&ms no&mall+ initiates the lo)on seC en$e>

Shik Mahamood Ali Usage Notes:

77

?se an "n9-o)on t&i))e& to initiate a lo)on (&o$ed &e to a non9"5A#-4 data so &$e> '&e9-o)on and 'ost9-o)on t&i))e&s fi&e as (a&t of the lo)on (&o$ed &e> Bo $an s ((l+ a N?-- $ommand to this t&i))e& to ,+(ass the $onne$tion to a data so &$e1 if +o /ant to $&eate an a((li$ation that does not &eC i&e a data so &$e> 7o (e&fo&m the defa lt "&a$le <o&ms (&o$essin) f&om this t&i))e&1 in$l de a $all to the -"D"N , ilt9in>

/"-L*." connected B''L"*,&4F*LS"7 tries ,13B".&4 7 un ,13B".7 pw C*.-$*.2= E>7 cs C*.-$*.2= E>7 B"0!, S"T2*66L!-*T!',26.'6".T:=-1.S'.2ST:L"<A/"F*1LTA>7 +$!L" -',,"-T"/ 4 F*LS" *,/ tries @ E L''6 L'0',2S-."",7 un&40"T2*66L!-*T!',26.'6".T:= 1S".,*3" >7 pw&40"T2*66L!-*T!',26.'6".T:= 6*SS+'./ >7 cs&4 0"T2*66L!-*T!',26.'6".T:= -',,"-T!',2ST.!,0 >7 L'0',= un< pw II MNA II -S < F*LS" >7 !F F'.32S1-"SS T$", -onnected&4T.1"7 ",/ !F7 Tries&4tries)17 ",/ L''67 !F ,'T -',,"-T"/ T$", 3"SS*0"=MToo many triesA>7 .*!S" F'.32T.!00".2F*!L1."7 ",/ !F7 ",/7

'# $*-2-5*6*N 24I66E4 D s/ription Fires after eit"er of t"e follo,ing events4 T"e successful completion of Form Builder default logon processing. T"e successful execution of t"e /nM$ogon trigger.

xample T"is example calls a user exit to log t"e current username and time to an encrypted audit trail file on t"e file system+ ,"ic" for security reasons is outside t"e database. BEGIN EN#; ,ser_E>it( 8o0Cry?t ;; ,SE-;; ;;$<_C!"-(S.S#"$E1 ....44##!!ET4ISS ));

Shik Mahamood Ali

78

(# $re-5ogout 2rigger Fires once before Form Builder initiate a logout procedure. Usa7 Not s Use a #reM$ogout trigger to prepare t"e form for logging out from t"e data source+ particularly a nonM/.5)$ data source. If you call certain builtMins from ,it"in one of t"e $ogout triggers+ t"e results are undefined. For example+ t"e )/#6 builtMin cannot be called from a #reM$ogout trigger because #reM$ogout fires after t"e $eave t"e Form event. Because t"e form is no longer accessible at t"is point+ t"e )/#6 operation is not possible.

)# *n-5ogout 2rigger Fires ,"en Form Builder normally initiates a logout procedure from Form Builder and from t"e .DBM&. Usa7 Not s Use an /nM$ogout trigger to replace t"e default logout processing eit"er from t"e .DBM& or from a nonM/.5)$ data source. To perform t"e default Form Builder processing from t"is trigger+ include a call to t"e $/G/UT builtMin. If you call certain builtMins from ,it"in one of t"e $ogout triggers+ t"e results are undefined. For example+ you cannot call t"e )/#6 builtMin from a #reM$ogout trigger because #reM$ogout fires after t"e $eave t"e Form event. Because t"e form is no longer accessible+ a )/#6 operation is not possible.

+# $ost-5ogout 2rigger D s/ription Fires after eit"er of t"e follo,ing events4 Form Builder successfully logs out of /.5)$ . T"e successful execution of t"e /nM$ogout trigger.

Usage Notes ,se a 7ost68o0out tri00er to audit or to ?er'orm tasks o) a) Form Builder a??licatio) t(at does )ot reIuire or a''ect t(e -#B4S or ot(er data source. I' you call certai) *uilt6i)s 'rom /it(i) o)e o' t(e 8o0out tri00ers1 t(e results are u)de'i)ed. For e>am?le1 you ca))ot call C<7. 'rom a 7re68o0out tri00er *ecause 7re68o0out 'ires a'ter t(e 8ea@e t(e Form e@e)t. Because t(e 'orm is )o lo)0er accessi*le1 a C<7. o?eratio) is )ot ?ossi*le.

Shik Mahamood Ali

79

This e#ample calls a user e#it to log the current username and time to an encrypted audit trail file on the file system< which for security reasons is outside the database. B"0!, 1ser2"#it=ALog-rypt AII1S".IIA A II T'2-$*.=S:S/*T"<A::::33//$$2G3!SSA>>7 ",/7

J,MOUSE TRI11ERS "# When-7ouse-%lic3 2rigger D s/ription Fires after t"e operator clic2 t"e mouse if one of t"e follo,ing events occurs4 if attac"ed to t"e form+ ,"en t"e mouse is clic2ed ,it"in any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse is clic2ed ,it"in any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse is clic2ed ,it"in t"e item

T"ree events must occur before a ;"enMMouseM)lic2 trigger ,ill fire4 Mouse do,n Mouse up Mouse clic2

5ny trigger t"at is associated ,it" t"ese events ,ill fire before t"e ;"enMMouseM)lic2 trigger fires. Usa7 Not s

Use t"e ;"enMMouseM)lic2 trigger to perform an action every time t"e operator clic2s t"e mouse ,it"in an item and%or canvas.

&# When-7ouse-Double%lic3 2rigger D s/ription Fires after t"e operator doubleMclic2s t"e mouse if one of t"e follo,ing events occurs4 if attac"ed to t"e form+ ,"en t"e mouse is doubleMclic2ed ,it"in any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse is doubleMclic2ed ,it"in any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse is doubleMclic2ed ,it"in t"e item

&ix events must occur before a ;"enMMouseMDouble)lic2 trigger ,ill fire4 Mouse Mouse Mouse Mouse Mouse Mouse do,n up clic2 do,n up doubleMclic2

Shik Mahamood Ali

80

5ny trigger t"at is associated ,it" t"ese events ,ill fire before t"e ;"enMMouseMDouble)lic2 trigger fires. Usa7 Not s

Use a ;"enMMouseMDouble)lic2 trigger to perform an action every time t"e operator Double)lic2 t"e mouse ,it"in an item and%or canvas. (= n-Mous -Dou0l Cli/: Tri77 r Exampl 5ssume t"at an application re*uires Be"avior 5 ,"en t"e operator clic2s t"e mouse and Be"avior B ,"en t"e operator doubleMclic2s t"e mouse. For example+ if t"e operator clic2s t"e mouse+ a product information ,indo, must appear. If t"e operator doubleMclic2s t"e mouse+ an online "elp ,indo, must appear. '# When-7ouse-Down 2rigger D s/ription Fires after t"e operator presses do,n t"e mouse button if one of t"e follo,ing events occurs4 Usa7 if attac"ed to t"e form+ ,"en t"e mouse is pressed do,n ,it"in any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse is pressed do,n ,it"in any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse is pressed ,it"in t"e item Not s Use a ;"enMMouseMDo,n trigger to perform an action every time t"e operator presses do,n t"e mouse button ,it"in an item and%or canvas. xampl s

Not ! T"e mouse do,n event is al,ays follo,ed by a mouse up event.

(# When-7ouse-Enter 2rigger D s/ription Fires ,"en t"e mouse enters an item or canvas if one of t"e follo,ing events occurs4 Usa7 if attac"ed to t"e form+ ,"en t"e mouse enters any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse enters any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse enters t"e item Not s

Use a ;"enMMouseM nter trigger to perform an action every time t"e mouse enters an item or canvas. Do not use t"e ;"enMMouseM nter trigger on a canvas t"at is larger t"an t"e ,indo,. Iconic buttons and items on t"e canvas belo, t"e initial ,indo, cannot be selected. T"e user is able to scroll t"e canvas to see t"e items. Go,ever+ as soon as t"e mouse enters t"at area+ t"e trigger fires and returns focus to t"e previous target+ so t"e user is never able to clic2 on t"ose items. )"anging a tooltipUs property in a ;"enMMouseM nter trigger cancels t"e tooltip before it is ever s"o,n.

Shik Mahamood Ali

81

Be careful ,"en calling a modal ,indo, from a ;"enMMouseM nter trigger. Doing so may cause t"e modal ,indo, to appear unnecessarily. For example+ assume t"at your ;"enMMouseM nter trigger causes 5lert=/ne to appear ,"enever t"e mouse enters )anvas=/ne. 5ssume also t"at your application contains t,o canvases+ )anvas=/ne and )anvas=T,o. )anvas=/ne and )anvas=T,o do not overlap eac" ot"er+ but appear side by side on t"e screen. Furt"er+ assume t"at 5lert=/ne displays ,it"in )anvas=T,oUs border. Finally+ assume t"at t"e mouse "as entered )anvas=/ne causing t"e ;"enMMouseM nter trigger to fire ,"ic" in turn causes 5lert=/ne to appear. ;"en t"e operator dismisses t"e message box+ 5lert=/ne ,ill appear again unnecessarily i( t"e operator subse*uently enters )anvas=/ne ,it" t"e mouse. In addition+ ,"en t"e operator moves t"e mouse out of )anvas=T,o+ any ;"enMMouseM$eave triggers associated ,it" t"is event ,ill fire. T"is may not be t"e desired be"avior. *e0i) :G8<B"8.sa@e_item_)ame := :S.S$E4.C,-S<-_I$E4; G<_I$E4(:s_ord.id:); S!<5_VIE5(:c@_(el?:);

E)d;

5!EN64<,SE6EN$E- at Form 8e@el *e0i) IF :S.S$E4.4<,SE_C"NV"S = :CV_<-#E-: $!EN :co)trol.s(o/_(el?_*utto) := :P:; EN# IF;

E)d; )# When-7ouse-5ea8e 2rigger D s/ription Fires after t"e mouse leave an item or canvas if one of t"e follo,ing events occurs4 Usa7 if attac"ed to t"e form+ ,"en t"e mouse leaves any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse leaves any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse leaves t"e item Not s

Use a ;"enMMouseM$eave trigger to perform an action every time t"e mouse leaves an item and%or canvas. 5!EN64<,SE68E"VE tri00er o) co)trol.s(o/_(el?_*utto) *e0i) E)d; !I#E_VIE5(:c@_(el?:); G<_I$E4(:G8<B"8.sa@e_item_)ame);

+# When-7ouse-7o8e 2rigger D s/ription Fires eac" time t"e mouse moves if one of t"e follo,ing events occurs4

Shik Mahamood Ali 82 if attac"ed to t"e form+ ,"en t"e mouse moves ,it"in any canvas or item in t"e form if attac"ed to a bloc2+ ,"en t"e mouse moves ,it"in any item in t"e bloc2 if attac"ed to an item+ ,"en t"e mouse moves ,it"in t"e item Usa7 Not s

Use t"e ;"enMMouseMMove trigger to perform an action every time t"e operator moves t"e mouse.

T"e ;"enMMouseMMove trigger may "ave performance implications because of t"e number of times t"is trigger can potentially fire.

,# When-7ouse-Up 2rigger D s/ription Fires eac" time t"e operator presses do,n and releases t"e mouse button if one of t"e follo,ing events occurs4 if a if if attac"ed to t"e form+ ,"en t"e mouse up event is received ,it"in any canvas or item in form attac"ed to a bloc2+ ,"en t"e mouse up event is received ,it"in any item in a bloc2 attac"ed to an item+ ,"en t"e mouse up event is received ,it"in an item

T,o events must occur before a ;"enMMouseMUp trigger ,ill fire4 Usa7 Mouse do,n Mouse up Not s

Use t"e ;"enMMouseMUp trigger to perform an action every time t"e operator presses and releases t"e mouse. T"e mouse up event is al,ays associated ,it" t"e item t"at received t"e mouse do,n event. For example+ assume t"at t"ere is a ;"enMMouseMUp trigger attac"ed to Item=/ne. If t"e operator presses do,n t"e mouse on Item=/ne+ but t"en releases t"e mouse on Item=T,o+ t"e mouse up trigger ,ill fire for Item=/ne+ rat"er t"an for Item=T,o. *,OT-ER TRI11ERS "# User-Named 2rigger 5 userBnamed trigger is a trigger t"at you define yourself in a form+ and t"en call explicitly from ot"er triggers or userBnamed subprograms. ac" userBnamed trigger defined at t"e same definition level must "ave a uni*ue name. To execute a userBnamed trigger+ you must call t"e X )UT =T.IGG . builtBin procedure+ as s"o,n "ere4 E>ecute_$ri00er(:my_user_)amed_tri00er:); Not ! 6ou can ,rite userBnamed #$%&'$ subprograms to perform almost any tas2 for ,"ic" you mig"t use a userBnamed trigger. Usa7 Not s

UserMnamed #$%&'$ subprograms can be ,ritten to perform almost any tas2 for ,"ic" one mig"t use a userMnamed trigger.

Shik Mahamood Ali 83 5s ,it" all triggers+ t"e scope of a userMnamed trigger is t"e definition level and belo,. ;"en more t"an one userMnamed trigger "as t"e same name+ t"e trigger defined at t"e lo,est level "as precedence. It is most practical to define userMnamed triggers at t"e form level. )reate a userMnamed trigger to execute userMnamed subprograms defined in a form document from menu #$%&'$ commands and userMnamed subprograms. 9UserMnamed subprograms defined in a form cannot be called directly from menu #$%&'$+ ,"ic" is defined in a different document.: In t"e menu #$%&'$+ call t"e X )UT =T.IGG . builtMin to execute a usernamed trigger+ ,"ic" in turn calls t"e userMnamed subprogram defined in t"e current form. DO"*EY 0uilt-in xecutes t"e 2ey trigger t"at corresponds to t"e specified builtMin subprogram. If no suc" 2ey trigger exists+ t"en t"e specified subprogram executes. T"is be"avior is analogous to pressing t"e corresponding function 2ey. S.ntax #./) DU. D/=D 6 9!uilt-in_su!program_name >5.)G5.(:F DO"*EY r stri/tions D/=D 6 accepts builtMin names only+ not 2ey names4 D/=D 69 1T .='U .6:. To accept a specific 2ey name+ use t"e X )UT =T.IGG . builtMin4 X )UT =T.IGG .9UD 6=F!!U:. DO"*EY xampl s

%C CC BuiltMin4 D/=D 6 CC xample4 &imulate pressing t"e R xecute 'ueryS 2ey. C% B GI1 1DF &# *n--a8epoint 2rigger Fires ,"en Form Builder ,ould normally issue a &avepoint statement. By default+ Form Builder issues savepoints at form startup+ and at t"e start of eac" #ost and )ommit Transaction process. Usage Notes To perform default Form Builder processing from t"is trigger+ include a call to t"e I&&U =&5> #/I1T builtMin. In an /nM&avepoint trigger+ t"e &avepoint=1ame application property returns t"e name of t"e next savepoint t"at Form Builder ,ould issue by default+ if no /nM&avepoint trigger ,ere present. In an /nM.ollbac2 trigger + &avepoint=1ame returns t"e name of t"e savepoint to ,"ic" Form Builder ,ould roll bac2. &uppress default savepoint processing by setting t"e &avepoint Mode form document property to /ff. ;"en &avepoint Mode is /ff+ Form Builder does not issue savepoints and+conse*uently+ t"e /nM&avepoint trigger never fires. %& && Built6i): ISS,E_S"VE7<IN$ && E>am?le: 7er'orm Form Builder sta)dard sa@e?oi)t ?rocessi)0. && #ecide /(et(er to use t(is *uilt6i) *ased o) a 0lo*al 'la0 setu? at startu? *y t(e 'orm1?er(a?s *ased o) a ?arameter. && $ri00er: <)6Sa@e?oi)t &% Do=Dey9U xecute='ueryU:F

Shik Mahamood Ali

84

#EC8"-E s?_)ame V"-C!"-E(RO); BEGIN /* 2et the name of the sa3epoint Form 1uilder needs to issue */ s?_)ame := Get_"??licatio)_7ro?erty(S"VE7<IN$_N"4E); /* Chec- the glo'al flag !e setup at form startup */ IF :Glo*al.,si)0_$ra)sactio)al_$ri00ers = $-,E $!EN ,ser_E>it( my_sa@e?t )ame= ;;s?_)ame); /* Other!ise, do the right thing. */ E8SE Issue_Sa@e?oi)t(s?_)ame); EN# IF; EN#; '# $ost-%hange 2rigger Fires ,"en any of t"e follo,ing conditions exist4 T"e >alidate t"e Item process determines t"at an item is mar2ed as )"anged and is not 1U$$. 5n operator returns a value into an item by ma2ing a selection from a list of values+ and t"e item is not 1U$$. Form Builder fetc"es a nonM1U$$ value into an item. In t"is case+ t"e ;"enM>alidateM Item trigger does not fire. If you ,ant to circumvent t"is situation and effectively get rid of t"e #ostM)"ange trigger+ you must include a #ostM'uery trigger in addition to your ;"enM>alidateMItem trigger. &ee OUsage 1otesO belo,.

Usage Notes T"e #ostM)"ange trigger is included only for compatibility ,it" previous versions of Form Builder. Its use is not recommended in ne, applications. T"e #ostM'uery trigger does not "ave t"e restrictions of t"e #ostM)"ange trigger. 6ou can use #ostM'uery to ma2e c"anges to t"e fetc"ed database values. Given suc" c"anges+ Form Builder mar2s t"e corresponding items and records as c"anged.

'# *n-5oc3 2rigger Fires ,"enever /racle Forms ,ould normally attempt to loc2 a ro,+ suc" as ,"en an operator presses a 2ey to modify data in an item. T"e trigger fires bet,een t"e 2ey press and t"e display of t"e modified data. Usage Notes: Use an /nB$oc2 trigger to replace t"e default /racle Forms processing for loc2ing ro,s. For example+ if you are designing an application for use on a singleBuser system+ you can use t"e /nB$oc2 trigger to speed processing by bypassing all loc2 processing. 5lso+ use /nB$oc2 if you are accessing a nonB/.5)$ data source directly+ not by ,ay of /pen Gate,ay. ;"en t"e /nB$oc2 trigger fires as a result of an operator trying to modify data+ t"e trigger fires only t"e first time t"e operator tries to modify an item in t"e record. T"e trigger does not fire during subse*uent modifications to items in t"e same record. In ot"er ,ords+ for every ro, t"at is to be loc2ed+ t"e trigger fires once.

Shik Mahamood Ali 85 To perform t"e default /racle Forms processing from t"is trigger+ include a call to t"e $/)D=. )/.D builtBin. Use t"is trigger to loc2 underlying tables for nonBupdateable vie,s.

%& && Built6i): 8<CQ_-EC<-# && E>am?le: 7er'orm Form Builder sta)dard record locki)0 o) t(e Iueried record /(ic( (as Nust *ee) deleted or u?dated. #ecide /(et(er to use de'ault ?rocessi)0 or a user e>it *y co)sulti)0 a 0lo*al 'la0 setu? at startu? *y t(e 'orm1?er(a?s *ased o) a ?arameter. && $ri00er: <)68ock &% BEGIN /* ** Chec- the glo'al flag !e set up at form startup */ IF :Glo*al.No)_<racle_#atasource = $-,E $!EN ,ser_E>it( my_lockrec *lock=E47 ); /* ** Other!ise, do the right thing. */ E8SE EN# IF; EN#; )# $re-$opup-7enu 2rigger T"is trigger is called ,"en a user causes a popMup menu to be displayed. 9In a Microsoft ;indo,s environment+ t"is occurs ,"en a user presses t"e rig"t mouse button.: 5ctions defined for t"is trigger are performed before t"e popMup menu is displayed. Usage Notes Use t"is trigger to enable or disable menu items on a popMup menu before it is displayed. +# 9uer -$rocedure 2rigger 5utomatically created by Form Builder ,"en t"e *uery data source is a stored procedure. T"is trigger is called ,"en a *uery operation is necessary. T"in2 of t"is as an /nM'uery trigger t"at is called by t"e system instead of doing default *uery operations. Usa7 Not s 8ock_-ecord;

;"en constructing a *uery+ any of t"e items may be used+ but t"e 'uery Data &ource )olumns property must be set so t"at t"ose items can be passed to t"e *uery stored procedure. T"en+ t"e *uery stored procedure "as to use t"ose values to filter t"e data. T"is means t"at t"e enter *uery mode does not "appen automatically unless you specify it. ,# Update-$rocedure 2rigger 5utomatically created by Form Builder ,"en t"e update data source is a stored procedure. T"is trigger is called ,"en a update operation is necessary. T"in2 of t"is as an /nMUpdate trigger t"at is called by t"e system instead of doing default update operations.

Shik Mahamood Ali .# When-%ustom-Item-E8ent 2rigger

86

Fires ,"enever a >BX control sends an event to /racle Forms. Usa7 Not s!

Use a ;"enB)ustomBItemB vent trigger to respond to a selection or c"ange of value for a >BX control. T"e system variable &6&T M.)U&T/M=IT M= > 1T stores t"e caseBsensitive name of t"e event t"at occurred+ and t"e system variable &6&T M.)U&T/M=IT M= > 1T=#5.5M T .& stores a parameter name t"at contains t"e supplementary arguments for an event t"at is fired by a >BX control. Exa'ple: 7his is an e0am(le of a (&o$ed &e that $an ,e $alled /hen "&a$le <o&ms fi&es the 3hen9# stom9Item94.ent 7&i))e&> #EC8"-E $a*E@e)t @arc(arE(RO); $a*Num*er Num*er; BEGIN $a*E@e)t := :system.custom_item_e@e)t; /* ** 7fter detecting a Clic- e3ent, identif( the ** ta' selected, and use the user8defined 2oto_Ta'_9age procedure to na3igate to the selected page. */ IF (,77E-($a*E@e)t) = :C8ICQ:) $!EN $a*Num*er := VBB.Get_7ro?erty(:$"BC<N$-<8:1:Curr$a*:); Goto_$a*_7a0e($a*Num*er); EN# IF;

EN#; /# When-Form-Na8igate 2rigger

Fires ,"enever any peer form navigation ta2es place. form Use a ;"enBFormB1avigate trigger to perform actions ,"en any cross form navigation ta2es place ,it"out relying on ,indo, activate and ,indo, deactivate events. T"is is an example of a procedure t"at can be called ,"en /racle Forms fires t"e ;"enBFormB 1avigate Trigger. #EC8"-E /i)_id 5IN#<5 := FIN#_5IN#<5(:5IN#<5GE:); BEGIN i' (GE$_5IN#<5_7-<7E-$.(/i)_id15IN#<5_S$"$E) = :4"BI4IDE: $!EN SE$_5IN#<5_7-<7E-$.(/i)_id15IN#<5_S$"$E14INI4IDE); else SE$_5IN#<5_7-<7E-$.(/i)_id15IN#<5_S$"$E14"BI4IDE); e)d i'; EN#; "1# When-2ab-$age-%hanged Fires ,"enever t"ere is explicit item or mouse navigation from one tab page to anot"er in a tab canvas. Usa7 Not s

Use a ;"enMTabM#ageM)"anged trigger to perform actions ,"en any tab page is c"anged during item or mouse navigation.

Shik Mahamood Ali 87 ;"enMTabM#ageM)"anged fires only ,"en tab page navigation is explicitF it does not respond to implicit navigation. For example+ t"e trigger ,ill fire ,"en t"e mouse or 2eyboard is used to navigate bet,een tab pages+ but t"e trigger ,ill not fire if an end user presses R1ext ItemS 9Tab: to navigate from one field to anot"er field in t"e same bloc2+ but on different tab pages. ;"enMTabM#ageM)"anged does not fire ,"en t"e tab page is c"anged programmatically.

Example %& ,se a 5(e)6$a*67a0e6C(a)0ed tri00er to dy)amically c(a)0e a ta* ?a0e s la*el 'rom lo/er6 to u??er6 case (to i)dicate to e)d users i' t(ey already (a@e && )a@i0ated to t(e ta* ?a0e): &% #EC8"-E t?_)m V"-C!"-E(SO); t?_id $"B_7"GE; t?_l* V"-C!"-E(SO); BEGIN t?_)m := GE$_C"NV"S_7-<7E-$.( em?_c@s 1 to?most_ta*_?a0e); t?_id := FIN#_$"B_7"GE(t?_)m); t?_l* := GE$_$"B_7"GE_7-<7E-$.(t?_id1 la*el); IF t?_l* 8IQE SaA $!EN SE$_$"B_7"GE_7-<7E-$.(t?_id1 la*el1 S"8"-. ); E8SIF t?_l* 8IQE VaA $!EN SE$_$"B_7"GE_7-<7E-$.(t?_id1 la*el1 V"C"$I<N ); E8SE )ull; EN# IF;

EN#; $$, When-2ree-Node-:cti8ated 2rigger

Fires ,"en an operator doubleMclic2s a node or presses nter ,"en a node is selected. Usa7 Not s &6&T M.T.IGG .=1/D is t"e node t"e user clic2ed on. &6&T M.T.IGG .=1/D returns a value of type 1/D . 1o programmatic action ,ill cause t"e ;"enMTreeM1odeM5ctivated trigger to fire. /nly endMuser action ,ill generate an event.

"&# When-2ree-Node-Expanded 2rigger Fires ,"en a node is expanded or collapsed. Usa7


Not s

&6&T M.T.IGG .=1/D is t"e node t"e user clic2ed on. &6&T M.T.IGG .=1/D returns a value of type 1/D . 1o programmatic action ,ill cause t"e ;"enMTreeM1odeM xpanded trigger to fire. /nly endMuser action ,ill generate an event.

"'# When-2ree-Node--elected 2rigger Fires ,"en a node is selected or deselected. Usa7 Not s

&6&T M.T.IGG .=1/D is t"e node t"e user clic2ed on. &6&T M.T.IGG .=1/D returns a value of type 1/D .

Shik Mahamood Ali 88 1o programmatic action ,ill cause t"e ;"enMTreeM1odeM&elected trigger to fire. /nly endM user action ,ill generate an event.

Defining list items


A list item dis(la+s a (&edefined set of $hoi$es that

a&e m t all+ e0$l si.e $an ,e dis(la+ed as eithe& a (o(list1 te0t list1 o& $om,o ,o0
LIST ITEM
#oplist Text $ist
DESCRIPTION

)ombo Box

5ppears initially as a single field 9similar to a text item field:. ;"en t"e operator selects t"e list icon+ a list of available c"oices appears. 5ppears as a rectangular box ,"ic" displays a fixed number of values. ;"en t"e text list contains values t"at cannot be displayed 9due to t"e displayable area of t"e item:+ a vertical scroll bar appears+ allo,ing t"e operator to vie, and select undisplayed values. )ombines t"e features found in list and text items. Unli2e t"e poplist or t"e text list style list items+ t"e combo box style list item ,ill display fixed values and accept one operatorMentered value. T"e combo box list item appears as an empty box ,it" an icon to t"e rig"t. T"e user can enter text directly into t"e combo field or clic2 t"e list icon to display a list of available values.

Vous aimerez peut-être aussi