Form Quick Reference Trigger Scope Form Trigger Type KeyOn- Block Pre- DEBUG.SETx(varname) RAISE DEBUG.BREAK Item Post- When- Trigger Code -BEGIN and END keywords require if DECLARE statement is included. -INSERT, UPDATE, and DELETE statement must be placed only in transactional triggers. -COMMIT, ROLLBACK, and SAVEPOINT cannot be included directly as SQL trigger statements. Execution Hierarchy Property Override (default) After Before Trigger Properties Name Fire in Enter Query Mode Execution Hierarchy Form Builder Variables Item :block_name.item_name Global :GLOBAL.variable_name System :SYSTEM.vairable_name Parameter :PARAMETER.name Built-ins for Global Variables Initializing DEFAULT_VALUE(‘initial_value’,’global_name’) Removing ERASE(‘global_name’) Unrestricted Built-ins -do not effect logical or physical navigation -can be called from any trigger, or from any subprogram Restricted Built-ins -affect navigation in the form -can call only in certain triggers Useful Commands in the Debugger .STEP INTO .STEP OVER .STEP OUT .GO .RESET .SHOW LOCALS DEBUG.INTERPRET(string) DEBUG.GETx(varname) Item Interaction Triggers When-Button-Pressed When-Checkbo-Changed When-Radio-Changed When-Image-Pressed When-Image-Activated When-List-Changed When-List-Activated Interface Trigger When-Tab-PageChanged When-Timer-Expired When-Window-Activated When-Window-Closed When-Window-Deactivated When-Window-Resized Useful Interaction Built-ins CHECKBOX_CHECK(item) ADD_LIST_ELEMENT DELETE_ELEMENT SHOW_LOV(‘lov_name’, x, y) LIST_VALUES READ_IMAGE_FILE(filename, filetype, item_name) WRITE_IMAGE_FILE(filename, filetype, item_name, compression_quality, image_depth) Message-Handling Triggers On-Error On-Message Useful System Variables and Built-ins :SYSTEM.MESSAGE_LEVEL :SYSTEM.SUPPRES_WORKING MESSAGE(‘string’) SHOW_ALERT(‘alert_name’) SET_ALERT_PROPERTY SET_ALERT_BUTTON_PROPERTY FORM_SUCCESS FORM_FAILURE FORM_FATAL ERROR_CODE ERROR_TEXT ERROR_TYPE MESSAGE_CODE MESSAGE_TEXT MESSAGE_TYPE Exception FORM_TRIGGER_FAILURE Query Processing 1. Fire Pre-Query trigger 2. Construct Select Statment 3. Perform Query 4. Fetch a row in to a new record 5. Mark record as valid 6. Fire Post-Query trigger 7. Validate any record changes 8. Repeat step 4 for any remaining records of this query Query Triggers Pre-Query Post-Query Useful System Variables :SYSTEM.MODE -NORMAL -ENTER-QUERY -QUERY :SYSTEM.LAST_QUERY Useful Built-ins to obtain query information at run time GET_BLOCK_PROPERTY SET_BLOCK_PROPERTY GET_ITEM_PROPERTY SET_ITEM_PROPERTY EXECUTE_QUERY ENTER_QUERY Validation Unit Property -Item -Record -Block -Form Standard Validation Checks for Text Items -Format mask -Required -Data type -Lowest-Highest Allowed Value -Validate from List Validation Triggers When-Validate-Item When-Validate-Record Built-ins for Validation CLEAR_BLOCK CLEAR_FORM EXIT_FORM(commit_mode) ENTER SET_FORM_PROPERTY -VALIDATEION -VALIDATION_UNIT ITEM_IS_VALID VALIDATE(validation_unit) Validation Status NEW CHANGED VALID Navigation Unit Outside the form Form Block Record Item Navigation Properties Form Mouse naivation limit First navigation data block Block Navigation Style Previous navigation data block Next navigation data block Item Enabled Keyboard navigable Mouse navigate Previous navigation item Next naviation item Navigation Triggers Pre- and Post-Fire during navigation -Does not fire if validation unit is higher than trigger object -Allow restricted built-ins -Handle failure by returing to initial object When-New-”object”-Instance -Fire after naviagation -Does fire when validation unit is higher than the trigger object -Allow restricted and unrestricted built-ins -Are not affect by failure Pre-Triggers Pre-Form Pre-Block Pre-Record Pre-Text-Item Post-Triggers Post-Form Post-Block Post-Record Post-Text-Item When-New-”object”-Instance When-New-Form-Instance When-New-Block-Instance When-New-Record-Instance When-New-Item-Instance Built-ins for Navigation GO_FORM GO_BLOCK NEXT_BLOCK PREVIOUS_BLOCK GO_ITEM NEXT_ITEM PREVIOS_ITEM GO_RECORD NEXT_RECORD PREVIOUS_RECORD NEXT_SET UP DOWN SCROLL_UP SCROLL_DOWN SET_FORM_PROPERTY Built-ins for Navigation (cont’) GET_FORM_PROPERTY SET_BLOCK_PROPERTY GET_BLOCK_PROPERTY SET_RECORD_PROPERTY GET_RECORD_PROPERTY SET_ITEM_PROPERTY GET_ITEM_PROPERTY Transaction processing Post Phase -Writes record changes to base tables -Fires transactional triggers Commit Phase -Performs database commit The Commit Sequence of Events 1. Validate Form 2. Process savepoint. 3. Fire the Pre-Commmit trigger 4. Validate the block 5. Fire Tranasctional triggers for deleted, inserted , updated records 6. Fire the Post-Forms-Commit trigger 7. If Commit operation, issue SQL-COMMIT 8. Fire the Post-Database-Commit trigger Commit Triggers Pre-Commit Pre-Delete On-Delete Pre-Insert On-Insert Pre-Update On-Update Post-Forms-Commit Post-Database-Commit Commit Status :SYSTEM.FORM_STATUS NEW QUERY CHANGED :SYSTEM.BLOCK_STATUS NEW QUERY CHANGED :SYSTEM.RECORD_STATUS NEW INSERT QUERY Post-Delete Post-Insert Post-Update CHANGED Implementing Array DML 1. Enable the Array Processing Option 2. Set the DML Array Size >1 3. Specify block primary keys :SYSTEM.TRIGGER_ITEM using an .id extension 2. Assign the number to a global variable 3. Convert the variable back to the object data type. Current Status of Form :SYSTEM.RECORD_STATUS :SYSTEM.BLOCK_STATUS :SYSTEM.ITEM_STATUS GET_”Object”_Property GET_APPLICATION_PROPERTY GET_FORM_PROPERTY GET_BLOCK_PROPERTY GET_RELATION_PROPERTY GET_ITEM_PROPERTY GET_ITEM_INSTANCE_PROPERTY GET_LOV_PROPERTY GET_RADIO_BUTTON_PROPERTY GET_MENU_ITEM_PROPERTY GET_CANVAS_PROPERTY GET_TAB_PAGE_PROPERTY GET_VIEW_PROPERTY GET_WINDOW_PROPERTY SET_”Object”_Property SET_APPLICATION_PROPERTY SET_FORM_PROPERTY SET_BLOCK_PROPERTY SET_RELATION_PROPERTY SET_ITEM_PROPERTY SET_ITEM_INSTANCE_PROPERTY SET_LOV_PROPERTY SET_RADIO_BUTTON_PROPERTY SET_MENU_ITEM_PROPERTY SET_CANVAS_PROPERTY SET_TAB_PAGE_PROPERTY SET_VIEW_PROPERTY SET_WINDOW_PROPERTY FIND Built-ins FIND_ALERT FIND_BLOCK FIND_CANVAS FIND_EDITOR FIND_FORM FIND_LOV FIND_ITEM FIND_RELATION FIND_VIEW FIND_WINDOW ALERT BLOCK CANVAS EDITOR FORM LOV ITEM RELATION VIEW WINDOW Writing Flexible Code Current Input Focus :SYSTEM.CURSOR_BLOCK :SYSTEM.CURSOR_RECORD :SYSTEM.CURSOR_ITEM :SYSTEM.CURSOR_VALUE Using Object IDs 1. Declare the same type of variable 2. Use FIND built-in to assign the ID of the object. 3. Use the variable for later reference Trigger Focus :SYSTEM.TRIGGER_BLOCK :SYSTEM.TRIGGER_RECORD Using Object IDs Outside the initial PL/ SQL Block 1.Convert the ID to a numeric format Referencing Objects Indirectly NAME_IN returns the contents of an indicated variable. COPY assigns an indicated value to an indicated variable or item. or parameter lists -Code is shared as required, through libraries and the database Built-ins for starting Another Form OPEN_FORM CALL_FORM NEW_FORM OPEN_FORM built-ins OPEN_FORM(form_name, activate_mode, data_mode,session_mode, parameterlist) ; Activate_Mode Session_Mode Data_Mode :A := ’aaa’ :B := ’A’ NAME_IN(:B) NAME_IN(‘B’) NAME_IN(‘A’) ‘aaa’ ‘A’ ‘aaa’ COPY(‘bbb’,:B) COPY(‘bbb’,’B’) COPY(‘bbb’,’A’) COPY(‘bbb’,NAME_IN(‘B’) :A=’bbb’ :B=’bbb’ :A=’bbb’ :A=’bbb’ Property Class -A object contains a list of properties and thier settings. Obejct Group -A logical container for a set of Form Builder objects. Object Library -A convenient container of objects for reuse -can contain simple objects, property classes, object groups, and program units. ACTIVATE, NO_ACTIVATE NO_SESSION, SESSION NO_SHARE_LIBRARY_DATA SHARE_LIBRARY_DATA Built-in for closing a Form EXIT_FORM(commit_mode) ; commit_mode ASK_COMMIT DO_COMMIT NO_COMMIT NO_VALIDATE Other Useful Triggers Parent form -When-Button-Pressed -When-Validate-Item -When-New-Record-Instance Opened form -When-New-Form-Instance -Pre-Query -When-Create-Record SmartClass -An object in an object library that is frequenctly used as a class PL/SQL Library -A collection of PL/SQL program units, including procedures, functions, and packages. Multiple Form Applications Behavior: -Flexible navigation between windows -Single or multiple database connections -Transaction may span of opening fors, starting with current form Links: -Data is exchanged by global variables Last modified Feb 12,2002