This action might not be possible to undo. Are you sure you want to continue?
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 Executable
COMPONENTS OF FORMS 1.Form Builder It is used to create a form. The design and layout of data entry screens the creations of event driven PL/SQL code used for data validation and navigate can be done via form builder. 2.Form Compiler It is required to compile the file created in form builder and create a binary file, which can be executable form runtime. 3.Form Runtime It is used to run the complied code created by forms compiler. COMPONENTS OF FORM BUILDER 1. Object Navigator It is hierarchical browsing and editing interface that enables you locate and manipulate application objects quickly and easily. 2.Property Palette It is used set and modify the properties for all objects in form modules. 3.Layout Editor It is graphical design facility for creating and arranging interface items and graphical objects in your application. 4.PL / SQL Editor It is the integrated functionality of oracle procedure builder that exists with in form builder. It provides: Development of Trigger, Procedures, Functions and Packages Development of libraries to hold PL/SQL program unit. FORM MODULE TYPES 1.Form Module It is a collection of objectives such as block, canvas, items and event based PL/SQL code blocks called trigger . 2.Menu Module It is a collection of menu items. It can be main menu or sub menu. 3.PL / SQL Libraries The library module is a collection of PL/SQL function and package stored ion a single library file. This library file is the attached to form / menu modules. All other objects in the form or menu can now access share the collection of PL/SQL functions and procedures. 4.Object Libraries
Shik Mahamood Ali 2 It is a collection of form objects that you can use in other modules. You can create it to store, maintain and distribute standard objects that can be reuse across the entire development organization. 5. Object Group (Form Builder) An object group is a container for a group of objects. You define an object group when you want to package related objects so you can copy or subclass them in another module. OBJECTS OF FORMS 1.Blocks Block is logical owner of items. It provides a mechanism for grouping related items into a functional unit for storing, displaying and manipulating records. 2.Items These are interface objects that present data values to the user or enable the user to interact with the form. 3. Canvas A canvas is the background object upon which interface items appear. 4. Frames Frames are used to arrange items with in a block. 5. Windows Windows contains for all visual objects that make up a form builder application. 6. PL/SQL Code Block It is used for event driven code. That code automatically executes when a specific event occurs. Form Built - ins 1.CLEAR_FORM Causes Form Builder to remove all records from, or flush, the current form, and puts the input focus in the first item of the first block. 2.COMMIT_FORM Causes Form Builder to update data in the database to match data in the form. Form Builder first validates the form, then, for each block in the form, deletes, inserts, and updates to the database, and performs a database commit. As a result of the database commit, the database releases all row and table locks. 3.DEBUG_MODE Toggles debug mode on and off in a menu. When debug mode is on in a menu, Form Builder issues an appropriate message when a menu item command executes. 4. ENTER Validates data in the current validation unit. (The default validation unit is Item.)
5.ERASE Removes an indicated global variable, so that it no longer exists, and releases the memory associated with the global variable. Global always allocate 255 bytes of storage. To ensure
Shik Mahamood Ali 3 that performance is not impacted more than necessary, always erase any global variable when it is no longer needs 6. EXECUTE_TRIGGER EXECUTE_TRIGGER executes an indicated trigger. 7. EXIT_FORM Provides a means to exit a form, confirming commits and specifying rollback action. 8.FIND_FORM Searches the list of forms and returns a form module ID when it finds a valid form with the given name. You must define an appropriately typed variable to accept the return value. Define the variable with a type of Form module. 9. FORM_FAILURE Returns a value that indicates the outcome of the action most recently performed during the current Runform session. Use FORM_FAILURE to test the outcome of a built–in to determine further processing within any trigger. To get the correct results, you must perform the test immediately after the action executes. That is, another action should not occur prior to the test. Example: /* ** Built–in: FORM_FAILURE ** Example: Determine if the most recently executed built–in ** failed. */ BEGIN GO_BLOCK(’Success_Factor’); /* ** If some validation failed and prevented us from leaving ** the current block, then stop executing this trigger. ** ** Generally it is recommended to test ** IF NOT Form_Success THEN ... ** Rather than explicitly testing for FORM_FAILURE */ IF Form_Failure THEN RAISE Form_Trigger_Failure; END IF; END; FORM_FATAL Returns the outcome of the action most recently performed during the current Runform session.
Use FORM_FATAL to test the outcome of a built–in to determine further processing within any trigger. To get the correct results, you must perform the test immediately after the action executes. That is, another action should not occur prior to the test. Example: /* ** Built–in: FORM_FATAL
Shik Mahamood Ali 4 ** Example: Check whether the most–recently executed built–in had a fatal error.*/ BEGIN User_Exit(’Calculate_Line_Integral control.start control.stop’); /* ** If the user exit code returned a fatal error, print a ** message and stop executing this trigger. ** ** Generally it is recommended to test ** ** IF NOT FORM_SUCCESS THEN ... ** ** Rather than explicitly testing for FORM_FATAL IF Form_Fatal THEN Message(’Cannot calculate the Line Integral due to internal error.’); RAISE Form_Trigger_Failure; END IF;
FORM_SUCCESS Returns the outcome of the action most recently performed during the current Runform session. Use FORM_SUCCESS to test the outcome of a built–in to determine further processing within any trigger. To get the correct results, you must perform the test immediately after the action executes. That is, another action should not occur prior to the test. Note: FORM_SUCCESS should not be used to test whether a COMMIT_FORM or POST built–in has succeeded. Because COMMIT_FORM may cause many other triggers to fire, when you evaluate FORM_SUCCESS it may not reflect the status of COMMIT_FORM but of some other, more recently executed built–in. A more accurate technique is to check that the SYSTEM.FORM_STATUS variable is set to ’QUERY’ after the operation is done. Example: /* ** Built–in: FORM_SUCCESS ** Example: Check whether the most–recently executed built–in ** succeeded. BEGIN /* ** Force validation to occur*/ Enter; /* ** If the validation succeeded, then Commit the data. ** */ IF Form_Success THEN Commit; IF :System.Form_Status <> ’QUERY’ THEN Message(’Error prevented Commit’); RAISE Form_Trigger_Failure; END IF; END IF; END; FORMS_DDL FORMS_DDL( statement); Issues dynamic SQL statements at runtime, including server–side PL/SQL and DDL.
IF NOT Form_Success THEN Message (’Table Creation Failed’). */ DECLARE procname VARCHAR2(30). ELSE Message (’Table Created’).. COL2. while permitted. END. create the table. COLn). END.. Line breaks. IF NOT Form_Success THEN Message (’Table Creation Failed’).Shik Mahamood Ali 5 Note: All DDL operations issue an implicit COMMIT and will end the current transaction without allowing Oracle Forms to process any pending changes. BEGIN my_stmt := ’create table tmp(COL1 NUMBER’.. */ PROCEDURE Create_N_Column_Number_Table (n NUMBER) IS my_stmt VARCHAR2(2000). are not required. If you • • • • • If you use FORMS_DDL to execute a valid PL/SQL block: Use semicolons where appropriate. ** Create a table with n Number columns. Example 3: /* ** Built–in: FORMS_DDL ** Example: The statement parameter can be a block ** of dynamically created PL/SQL code. END LOOP.. */ Forms_DDL(my_stmt). ** TEMP(COL1. BEGIN . Do not end the PL/SQL block with a slash. END IF. . FOR I in 2. use FORMS_DDL to execute a single DML or DDL statement: Example 1: /* ** Built–in: FORMS_DDL ** Example: The expression can be a string literal. Example 2: /* ** Built–in: FORMS_DDL ** Example: The string can be an expression or variable.COL’||TO_CHAR(i)||’ NUMBER’.*/ BEGIN Forms_DDL(’create table temp(n NUMBER)’).. /* ** Now. END IF. my_stmt := my_stmt||’)’.N LOOP my_stmt := my_stmt||’. ELSE Message (’Table Created’).. Enclose the PL/SQL block in a valid BEGIN/END block structure.
END IF. BEGIN IF stmt IS NULL THEN Message (’DO_SQL: Passed a null statement. ELSE Message (’Employee Maintenance Successful’). END. END IF. or called form. End. ** and return a number representing the outcome of ** executing the SQL statement. ID_NULL Returns a BOOLEAN value that indicates whether the object ID is available. Forms_DDL(stmt).’). ELSE procname := ’Update_New_Employer’. Forms_DDL(’Begin ’|| procname ||’. NEW_FORM . END.Shik Mahamood Ali 6 IF :global. check_for_locks BOOLEAN := TRUE) RETURN NUMBER IS SQL_SUCCESS CONSTANT NUMBER := 0. IF Form_Success THEN RETURN SQL_SUCCESS. as well as about the current. GET_FORM_PROPERTY Returns information about the given form. IF Check_For_Locks AND :System. ELSE RETURN Dbms_Error_Code.’). then you can call this built-in to return information about the calling form. END IF .’).flag = ’TRUE’ THEN procname := ’Assign_New_Employer’. Example 4: /* ** Built–in: FORMS_DDL ** Example: Issue the SQL statement passed in as an argument. RETURN SQL_SUCCESS. ** A result of zero represents success.Form_Status = ’CHANGED’ THEN Message (’DO_SQL: Form has outstanding locks pending. */ FUNCTION Do_Sql (stmt VARCHAR2. END IF. RETURN SQL_SUCCESS. If your application is a multi-form application. IF NOT Form_Success THEN Message (’Employee Maintenance Failed’). END IF.
and deletes in the form. To avoid losing the locks issued by the calling form. Specify a parameter list when you want to pass parameters from the calling form to the new form. paramlist_name . NEW_FORM (formmodule_name VARCHAR2. Oracle Forms keeps the higher call active and treats it as a call to the new form.data_mode. QUERY_ONLY Runs the indicated form as a query–only form. NO_ROLLBACK Oracle Forms exits the current form without rolling back to a savepoint.Shik Mahamood Ali 7 Exits the current form and enters the indicated form.paramlist_name ) formmodule_name Specifies the formmodule name of the called form. The name must be enclosed in single quotes. A parameter list passed to a form via NEW_FORM cannot contain parameters of type DATA_PARAMETER (a pointer to record group). (Post–only mode can occur when your form issues a call to another form while unposted records exist in the calling form.query_mode. rollback_mode. which means that you retain any locks across a NEW_FORM operation. The data type of the ID is PARAMLIST. Oracle Forms releases memory (such as database cursors) that the terminated form was using. paramlist_id Specifies the unique ID Oracle Forms assigns when it creates the parameter list. The calling form is terminated as the parent form. allowing the operator to perform inserts. You cannot specify a FULL_ROLLBACK from a form that is running in post–only mode. You can leave the top level form without performing a rollback. updates. Oracle Forms prevents any commit processing in the called form.) query_mode Takes one of the following constants as an argument: NO_QUERY_ONLY Runs the indicated form normally. These locks can also occur when invoking Oracle Forms from an external 3GL program. Oracle Forms runs the new form with the same options as the parent form. If the calling form had been called by a higher form. If the parent form was a called form. FULL_ROLLBACK Oracle Forms rolls back all uncommitted changes (including posted changes) that were made during the current Runform session. The locks are still in effect when you regain control from Oracle Forms. rollback_mode TO_SAVEPOINT Oracle Forms rolls back all uncommitted changes (including posted changes) to the current form’s savepoint. The data type of the name is CHAR. Oracle Forms runs the new form with the same Runform options as the parent form.
display NUMBER. or delete records. CALL_FORM (formmodule_name VARCHAR2. The data type of the name is CHAR. display Specify one of the following constants as an argument: HIDE Causes Oracle Forms to clear the calling form from the screen before drawing the called form. The name must be enclosed in single quotes. paramlist_id . DO_REPLACE Causes Oracle Forms to replace the default menu application of the calling form with the default menu application of the called form. NO_HIDE Causes Oracle Forms to display the called form without clearing the calling form from the screen. Runs an indicated form while keeping the parent form active.Shik Mahamood Ali 8 The name you gave the parameter list object when you defined it. Oracle Forms runs the called form with the same Runform preferences as the parent form. When the called form is exited Oracle Forms processing resumes in the calling form at the point from which you initiated the call to CALL_FORM. data_mode NUMBER. switch_menu Takes one of the following constants as an argument: NO_REPLACE Causes Oracle Forms to keep the default menu application of the calling form active for the called form. but not to insert. CALL_FORM. update. QUERY_ONLY Causes Oracle Forms to run the indicated form in Query Only mode. and deletes from within the called form. allowing the operator to perform inserts. query_mode Takes one of the following constants as an argument: NO_QUERY_ONLY Causes Oracle Forms to run the indicated form in normal mode. updates. switch_menu NUMBER. paramlist_name VARCHAR2). HIDE is the default parameter. Parameters: formmodule_name Specifies the formmodule name of the called form. A parameter list passed to a form via NEW_FORM cannot contain parameters of type DATA_PARAMETER (a pointer to record group). The data type of the name is CHAR. query_mode NUMBER. allowing the operator to query.
form_name. form_name. paramlist_id Specifies the unique ID that Oracle Forms assigns to the parameter list at the time it is created. form_name. activate_mode ACTIVATE Sets focus to the form to make it the active form in the application.paramlist_id).session_mode. OPEN_FORM( OPEN_FORM( OPEN_FORM( OPEN_FORM( OPEN_FORM( REPLACE_MENU form_name).session_mode.session_mode).DO_REPLACE. NO_ACTIVATE Opens the form but does not set focus to the form. The current form remains current. OPEN_FORM (form_name VARCHAR2.activate_mode).QUERY_ONLY). The data type of the name is CHAR.Shik Mahamood Ali 9 Specifies the unique ID Oracle Forms assigns when it creates the parameter list. paramlist_id PARAMLIST). Call OPEN_FORM to create multiple–form applications.activate_mode. session_mode NUMBER. A COMMIT operation in any form will cause validation and commit processing to occur for all forms running in the same session. session_mode NO_SESSION Specifies that the opened form should share the same database session as the current form. paramlist_name The name you gave the parameter list object when you defined it. The data type of the ID is PARAMLIST. You can optionally include a parameter list as initial input to the called form. SESSION Specifies that a new. that is. Call_Form(’lookcust’.activate_mode. OPEN_FORM Opens the indicated form.NO_HIDE.activate_mode. paramlist_name Specifies the CHAR name of a parameter list to be passed to the opened form. form_name.paramlist_name). separate database session should be created for the opened form. applications that open more than one form at the same time. activate_mode NUMBER. . Use the GET_PARAMETER_LIST function to return the ID to a variable of type PARAMLIST. form_name Specifies the CHAR name of the form to open. data_mode NUMBER.
CURRENT_FORM represents the name of the form that Form Builder is executing.Calling_Form := :System. Example 2: /* ** Built–in: GET_APPLICATION_PROPERTY ** Example: Capture the username and password of the ** currently logged–on user. value).Form_Status = ’CHANGED’THEN Commit_Form. Syntax: SET_FORM_PROPERTY( formmodule_id. 2.FORM_STATUS represents the status of the current form. Indicates that a query is open. PROCEDURE STORE_FORMNAME IS BEGIN :GLOBAL. for use in calling ** another Tool. The value can be one of three character strings: CHANGED Indicates that the form contains at least one block with a Changed record. NEW QUERY IF :System. property. END. You must call this built–in once for each value you want to retrieve. the_connect := Get_Application_Property(CONNECT_STRING). SYSTEM. . END. REPLACE_MENU also allows you to change the way the menu displays and the role. the_connect IN OUT VARCHAR2) IS BEGIN the_username := Get_Application_Property(USERNAME).System Variables 1. property.Shik Mahamood Ali 10 Replaces the current menu with the specified menu.FORM_STATUS becomes CHANGED only after at least one record in the form has been changed and the associated navigation unit has also changed.Current_Form. SET_FORM_PROPERTY Sets a property of the given form. tm_name := Get_Application_Property(TIMER_NAME). The value of SYSTEM. The form contains at least one block with QUERY records and no blocks with CHANGED records.FORM_STATUS SYSTEM. Form. Indicates that the form contains only New records. The value is always a character string. the_password IN OUT VARCHAR2.CURRENT_FORM SYSTEM. SET_FORM_PROPERTY( formmodule_name. the_password := Get_Application_Property(PASSWORD).SYSTEM. */ PROCEDURE Get_Connect_Info( the_username IN OUT VARCHAR2. Description: The GET_APPLICATION_PROPERTY built–in returns information about the current Oracle Forms application. but does not make the new menu active. value).
and delete rows within a database. Enter Query. or Fetch Processing mode. NORMAL Indicates that the form is currently in normal processing mode. It provides a mechanism for grouping related items into a functional unit for storing. END IF. Control Blocks A control block is not associated with the database. Example: Assume that you want Oracle Forms to display an LOV when the operator enters query mode and the input focus is in a particular text item. Data blocks can be based on database tables. 3. End if. Types of Blocks 1. In addition. Clear_Form. ENTER-QUERY Indicates that the form is currently in Enter Query mode.Cursor_Item = ’EMP. All blocks are either single-record or multi-record blocks: A single-record block displays one record at a time.Shik Mahamood Ali END IF.EMPNO’ and :System. and the items in a control block do not relate to table columns within a database. procedures. A detail block displays detail records associated with a master record displayed in master block. /* ** When–New–Item–Instance Trigger */ BEGIN IF :System. update. SYSTEM. BLOCKS Block is logical owner of items. or transactional triggers. 2. The following trigger accomplishes that operation. END. views. A multi-record block displays more than one record at a time. Data Blocks Data blocks are associated with data (table columns) within a database. MODE 11 SYSTEM. meaning that a query is currently being processed.MODE indicates whether the form is in Normal. The value is always a character string. the association between a data block and the database allows operators to automatically query. QUERY Indicates that the form is currently in fetch processing mode.Mode = ’ENTER–QUERY’ THEN IF NOT Show_Lov(’my_lov’) THEN RAISE Form_Trigger_Failure. insert. By default. displaying and manipulating records. . a data block can also be a master or detail block: Master block displays a master record associated with detail records displayed in a detail block.
and prints a message if ** the user chooses a new block out of the list to ** which to navigate.Cursor_Block <> prev_blk THEN Message(’You successfully navigated to a new block!’). 2. FIND_BLOCK Searches the list of valid blocks and returns a unique block ID. 3.Shik Mahamood Ali Block Built . END IF. and flushes the current block without prompting the end user. COMMIT_MODE The optional action parameter takes the following possible constants as arguments: ASK_COMMIT Form Builder prompts the end user to commit the changes during CLEAR_BLOCK processing. GET_BLOCK_PROPERTY Returns information about a specified block. You must issue a call to the built-in once for each property value you want to retrieve. . property). DO_COMMIT Form Builder validates the changes.ins 1. */ DECLARE prev_blk VARCHAR2(40) := :System. Form Builder sets the input focus to the first enterable item in the block you select from the LOV.Cursor_Block. GET_BLOCK_PROPERTY( block_name. You must define an appropriately typed variable to accept the return value. 4. Syntax: GET_BLOCK_PROPERTY( block_id. IF :System. performs a commit. BEGIN BLOCK_MENU. NO_VALIDATE Form Builder flushes the current block without validating the changes. NO_COMMIT Form Builder validates the changes and flushes the current block without performing a commit or prompting the end user. END. BLOCK_MENU built-in 12 Displays a list of values (LOV) containing the sequence number and names of valid blocks in your form. CLEAR_BLOCK built-in Causes Form Builder to remove all records from. property). committing the changes. Example: /* ** Built–in: BLOCK_MENU ** Example: Calls up the list of blocks in the form when the ** user clicks a button. Define the variable with a type of Block. or prompting the end user." the current block. Clear_Block(No_Validate). or "flush.
Set_Block_Property(blk_id. ** (2) Current Record which is visible at the ** first (top) line of the multirecord ** block. 5.SET_BLOCK_PROPERTY Sets the given block characteristic of the given block. Example: /* ** Built–in: SET_BLOCK_PROPERTY ** Example: Prevent future inserts. GO_BLOCK GO_BLOCK navigates to an indicated block. Otherwise signal ** an error. an error occurs. */ cur_rec := Get_Block_Property( bk_id. CURRENT_RECORD). If the target block is non-enterable .DELETE_ALLOWED. 6. value). and deletes to ** queried records in the block whose name is ** passed as an argument to this procedure. SET_BLOCK_PROPERTY( block_name. property.Shik Mahamood Ali 13 ** Determine the (1) Current Record the cursor is in. */ PROCEDURE Make_Block_Query_Only( blk_name IN VARCHAR2 ) IS blk_id Block. Syntax: SET_BLOCK_PROPERTY( block_id. top_rec := Get_Block_Property( bk_id. updates. 7. TOP_RECORD). ID_NULL Returns a BOOLEAN value that indicates whether the object ID is available.PROPERTY_FALSE). */ IF NOT Id_Null(blk_id) THEN Set_Block_Property(blk_id. Set_Block_Property(blk_id. value).PROPERTY_FALSE). NEXT_BLOCK Navigates to the first navigable item in the next enterable block in the navigation sequence 8.PREVIOUS_BLOCK Navigates to the first navigable item in the previous enterable block in the navigation sequence 9. ELSE .INSERT_ALLOWED. BEGIN /* Lookup the block’s internal ID */ blk_id := Find_Block(blk_name).PROPERTY_FALSE). property.UPDATE_ALLOWED. /* ** If the block exists (ie the ID is Not NULL) then set ** the three properties for this block.
SYSTEM. The value can be one of three character strings: CHANGED NEW QUERY Indicates that the block contains at least one Changed record.and Post.CURRENT_BLOCK is the name of the block that Form Builder is processing or that the cursor is in. or item (as in the Pre. The following Key–CLRBLK trigger performs this function. Record. END IF. or the current data block during trigger processing.’). RAISE Form_Trigger_Failure. If the current navigation unit is the form (as in the Pre. Indicates that the block contains only Valid records that have been retrieved from the database. or item (as in the Pre. Clear_Block.and Post-Form triggers). the value of SYSTEM. . record.CURSOR_BLOCK is NULL.Block_Status = ’CHANGED’ THEN Commit_Form.BLOCK_STATUS represents the status of a Data block where the cursor is located. record. If the current navigation unit is the form (as in the Pre.System Variables 1. IF :System. Indicates that the block contains only New records.CURSOR_BLOCK is the name of the block where the cursor is located.and Post-Form triggers).Shik Mahamood Ali 14 Message(’Block ’||blk_name||’ does not exist. END IF.CURRENT_BLOCK system variable represents depends on the current navigation unit: If the current navigation unit is the block. Example: Assume that you want to create a trigger that performs a commit before clearing a block if there are changes to commit within that block. the value of SYSTEM.and Post.CURSOR_BLOCK The value that the SYSTEM. the value of SYSTEM.Item. Record.SYSTEM. 3.CURSOR_BLOCK system variable represents depends on the current navigation unit: If the current navigation unit is the block. and Block triggers). and Block triggers). 2.BLOCK_STATUS SYSTEM.CURRENT_BLOCK is NULL. Block . the value of SYSTEM.Item. The value is always a character string.CURRENT_BLOCK The value that the SYSTEM.SYSTEM. END.
Shik Mahamood Ali Example: 15 Assume that you want to create a Key–NXTBLK trigger at the form level that navigates depending on what the current block is. 5.Trigger_Block’)). ELSIF curblk = ’ITEMS’ THEN Go_Block(’CUSTOMERS’). The value is NULL if the current trigger is a Pre.Cursor_Block. END. The following statement performs this function. A Detail Block Can Be a Master You can create block relationships in which the detail of one master-detail link is the master for another link. The following trigger performs this function. Example: Assume that you want to write a form–level procedure that navigates to the block where the cursor was when the current trigger initially fired.COORDINATION_OPERATION to help an On-Clear-Details trigger determine what type of coordination-causing operation fired the trigger. SYSTEM. When-Remove-Record MASTER-DETAIL RELATIONSHIP A master-detail relationship is an association between two data blocks that reflects a primaryforeign key relationship between the database tables on which the two data blocks are based. 4. A master-detail relationship equates to the one-tomany relationship in the entity relationship diagram. IF curblk = ’ORDERS’ THEN Go_Block(’ITEMS’). DECLARE curblk VARCHAR2(30). and the detail data block is based on the table with the foreign key. BEGIN curblk := :System.or Post-Form trigger. and on which master block of a master/detail relation. Block – Based Triggers [Block Processing Trigger] When-Create-Record. END IF. The value is always a character string. Go_Block(Name_In(’System. SYSTEM. using :SYSTEM. What Is a Relation? . When-Clear-Block.MASTER_BLOCK This system variable works with its companion SYSTEM.TRIGGER_BLOCK SYSTEM. When-Database-Record.CURSOR_BLOCK stored in a local variable.TRIGGER_BLOCK represents the name of the block where the cursor was located when the current trigger initially fired. The master data block is based on the table with the primary key. ELSIF curblk = ’CUSTOMERS’ THEN Go_Block(’ORDERS’).
Delete trigger. Property Use Non-Isolated Cascading Isolated Prevents the deletion of the master record when the detail records exist Deletes the detail records when a master record is deleted Deletes only the master record What Happens When You Modify a Relation? • • Changing the Master Deletes property from the default of Non-Isolated to Cascading replaces the On-Check-Delete-Master trigger with the Pre. or isolate deletion of a record in a master block when corresponding records exist in the detail block by setting the Master Deletes property. You can create a relation either: • Implicitly with a master-detail form module • Explicitly in the Object Navigator Implicit Relations When you create a master-detail form module. Explicit Relations If a relation is not established when default blocks are created. for example. you can create your own by setting the properties in the New Relation dialog box. Like implicitly created relations. MASTER DELETES PROPERTY RESULTING TRIGGERS Non-Isolated (the default) On-Check-Delete-Master On-Clear-Details On-Populate-Details Cascading On-Clear-Details On-Populate-Details Pre-Delete Isolated On-Clear-Details On-Populate-Details . Master Deletes You can prevent. you can delete all corresponding line items when an order is deleted. PL/SQL program units and triggers are created automatically when you explicitly create a relation. For example. propagate. S_ORD_S_ITEM.Shik Mahamood Ali 16 A relation is a Form Builder object that handles the relationship between two associated blocks. Changing the Master Deletes property from the default of Non-Isolated to Isolated results in the removal of the On-Check-Delete-Master trigger. a relation is automatically created. This relation is named masterblock_detailblock.
the operator must navigate to the detail data block and explicitly execute a query. data types. Non-query record groups can be created and modified only at runtime. The columns in a query record group derive their default names. you can defer querying the line items for an order until the operator navigates to the item block. Deferred Without Auto Query When coordination-causing event occurs. but whose structure and values can be modified programmatically at runtime. the detail records are fetched immediately. For example. Join Condition Use to: • • • • • Create links between blocks using SQL Alter links between blocks using SQL Define using: Usual SQL equi-join condition syntax Block names instead of the base table names Item names that exist in the form module instead of base table column names Master-detail triggers On-Check-Delete-Master. (Deferred False. and lengths from the database columns referenced in the SELECT statement. Query record groups can be created and modified at design time or at runtime. On-Populate-Details.Shik Mahamood Ali Coordination 17 You can control how the detail records are displayed when a master block is queried by setting the coordination property. When a coordination-causing event occurs. Prevent Masterless Operation Ensures that the detail data block cannot be queried or used to insert records when a master record is not currently displayed. On-Clear-Details RECORD GROUP This object represents an internal Form Builder data structure that has a column/row framework similar to a database table. Query record group A query record group is a record group that has an associated SELECT statement. Default [Immediate] The default setting. The records in a query record group are the rows retrieved by the query associated with that record group. Non-query record group A non-query record group is a group that does not have an associated query. Static record group . To fetch the detail records. Oracle Forms does not automatically fetch the detail records. Auto-Query False) Deferred with Auto Query Oracle Forms defers fetching the associated detail records until the operator navigates to the detail data block.
. query VARCHAR2. The record group has columns representing each column you include in the select list of the query C] DELETE_GROUP (recordgroup_name VARCHAR2). Sets the value for the record group cell identified by the given row and column. you define its structure and row values at design time. row_number NUMBER) Deletes the indicated row or all rows of the given record group. NUMBER). POPULATE_GROUP_WITH_QUERY (recordgroup_id RecordGroup. Deletes a programmatically created record group. cell_value DATE). SET_GROUP_CHAR_CELL(groupcolumn_id GroupColumn. the appropriate memory is freed and available to Form Builder. Static record groups can be created and modified only at design time. Modifying a group's structure: ADD_GROUP_COLUMN (recordgroup_name VARCHAR2. column_width NUMBER) Adds a column of the specified type to the given record group. row_number NUMBER. groupcolumn_name VARCHAR2. The record group is cleared and rows that are fetched replace any existing rows in the record group. Executes the query associated with the given record group and returns a number indicating success or failure of the query. The rows that are retrieved as a result of a successful query replace any rows that exist in the group. Upon a successful query.column_type NUMBER. ADD_GROUP_ROW (recordgroup_name VARCHAR2. array_fetch_size NUMBER). DELETE_GROUP_ROW (recordgroup_id RecordGroup. When rows are deleted. An unsuccessful query generates an ORACLE error number that corresponds to the particular SELECT statement failure. query VARCHAR2) Populates a record group with the given query. array_fetch_size NUMBER) Creates a non-query record group with the given name B] CREATE_GROUP_FROM_QUERY (recordgroup_name VARCHAR2. scope NUMBER. Form Builder automatically decrements the row numbers of all rows that follow a deleted row. and they remain fixed at runtime. instead. Creates a record group with the given name. POPULATE_GROUP returns a 0 (zero).cell_value VARCHAR2) Sets the value for the record group cell identified by the given row and column. Record Group built-in subprograms Creating and deleting groups: A] CREATE_GROUP (recordgroup_name VARCHAR2. SET_GROUP_DATE_CELL (groupcolumn_id GroupColumn.Shik Mahamood Ali 18 A static record group is not associated with a query. row_number Adds a row to the given record group. Populating Groups: POPULATE_GROUP (recordgroup_id RecordGroup).row_number NUMBER. scope NUMBER.
errcode NUMBER. */ rg_id := Find_Group(rg_name). ’Base_Sal_Range’. /* ** If it does not exist. gc_id GroupColumn. Sets the value for the record group cell identified by the given row and column. /* Add two number columns to the record group */ gc_id := Add_Group_Column(rg_id. END IF. A cell is an intersection of a row and column. GET_GROUP_DATE_CELL (function) GET_GROUP_NUMBER_CELL (function) Processing rows: GET_GROUP_ROW_COUNT (function) GET_GROUP_SELECTION_COUNT (function) GET_GROUP_SELECTION (function) RESET_GROUP_SELECTION (procedure) SET_GROUP_SELECTION (procedure) UNSET_GROUP_SELECTION (procedure) Object ID functions: FUNCTION FIND_GROUP (recordgroup_name VARCHAR2). Returns the VARCHAR2 or LONG value for a record group cell identified by the given row and column. Define the variable with a type of RecordGroup. create it and add the two ** necessary columns to it. /* ** Populate group with a query . NUMBER_COLUMN).*/ DECLARE rg_name VARCHAR2(40) := ’Salary_Range’. You must define an appropriately typed variable to accept the return value.cell_value NUMBER).Shik Mahamood Ali 19 SET_GROUP_NUMBER_CELL(groupcolumn_id GroupColumn. Getting cell values: GET_GROUP_CHAR_CELL (groupcolumn_id GroupColumn. gc_id := Add_Group_Column(rg_id. NUMBER_COLUMN). row_number NUMBER. Searches the list of record groups and returns a record group ID when it finds a valid group with the given name. BEGIN /* ** Make sure the record group does not already exist. FIND_COLUMN (function) Example: /* ** Built–in: CREATE_GROUP ** Example: Creates a record group and populates its values ** from a query. ’Emps_In_Range’. */ IF Id_Null(rg_id) THEN rg_id := Create_Group(rg_name). row_number NUMBER). rg_id RecordGroup.
1000) ’ ||’ORDER BY 1’).LIST_VALUES LIST_VALUES displays the list of values for the current item.Shik Mahamood Ali 20 */ errcode := Populate_Group_With_Query( rg_id. when the end user navigates to a text item with an associated LOV. SHOW_LOV( lov_id. LOV Properties . and FALSE if the operator Cancels and dismisses the list. END. LOV values that are selected by the end user can be assigned to form items according to the return items you designate. x. LOV Built-in subprograms 1.1000). SHOW_LOV( lov_name). LOV [ LIST OF VALUES ] An LOV is a scrollable popup window that provides the end user with either a single or multi-column selection list. an LOV can be attached to one or more text items in the form. Default Key for LOV – F9 LOVs provide the following functionality: LOVs can be displayed by end user request (when an LOV is available). LOV auto-reduction and search features allow end users to locate specific values. At design time. y). IF NOT a_value_chosen THEN Message(’You have not selected a value.COUNT(EMPNO) ’ ||’FROM EMP ’ ||’GROUP BY SAL–MOD(SAL. y). Example: /* ** Built–in: SHOW_LOV ** Example: Display a named List of Values (LOV) */ DECLARE a_value_chosen BOOLEAN.’). SHOW_LOV( lov_name. as long as the input focus is in a text item that has an attached LOV. RAISE Form_Trigger_Failure. BEGIN a_value_chosen := Show_Lov(’my_employee_status_lov’). Bell. x. independent of any specific text item. and returns TRUE if the operator selects a value from the list. or programmatically. END IF. 2. LOV values are derived from record groups. ’SELECT SAL–MOD(SAL. SHOW_LOV( lov_id).SHOW_LOV Displays a list of values (LOV) window at the given coordinates. The list of values remains displayed until the operator dismisses the LOV or selects a value.
Title property Specifies the title to be displayed for the object. value NUMBER). SET_LOV_COLUMN_PROPERTY Sets the given LOV property for the given LOV. Returns information about a specified list of values (LOV). property 5.Automatic Display property Specifies whether Form Builder displays the LOV automatically when the operator or the application navigates into a text item to which the LOV is attached. 9. the focus remains in the text item after the operator makes a selection from the LOV.'new_group').GROUP_NAME. 10. When Automatic Skip is set to No. Sets the given LOV property for the given LOV. Set_LOV_Property('my_lov'. the LOV remains displayed. When Automatic Confirm is set to No. Long List It is used to append a ‘ where clause ‘ to the select statement. 7. 4. . LOV. 6. 2. property NUMBER. the LOV is dismissed automatically and column values from the single row are assigned to their corresponding return items.Automatic Refresh property Determines whether Form Builder re-executes the query to populate an LOV that is based on a query record group. Automatic Skip (LOV) property Moves the cursor to the next navigable item when the operator makes a selection from an LOV to a text item. 8. LOV for Validation [ Yes / No ] If it is true so that the system check value entered with the list of values Validation from LOV – text item property . 3. SET_LOV_COLUMN_PROPERTY (lov_id NUMBER. from this value entered the where clause constructed.>If it is not specified then value from Lov cannot assigned to the block.Shik Mahamood Ali 21 1.Column Mapping This property is used to specify the return item. In this dialog box any value can be entered.colnum NUMBER.Validation from Lov to text item. 11.GROUP_NAME Specifies the name of the record group on which an LOV is based. When this property is true a dialog box appear. SET_LOV_PROPERTY(lov_id LOV. giving the operator the option to explicitly select the remaining choice or dismiss the LOV. property LOV).Automatic Select property Specifies what happens when an LOV has been invoked and the user reduces the list to a single choice when using auto-reduction or searching: When Automatic Confirm is set to Yes. GET_LOV_PROPERTY (lov_id.value VARCHAR2). 12.
key VARCHAR2) Deletes the parameter with the given key from the parameter list. but before Form Builder returns to the normal event sequence. an IF statement is added to the previous trigger: Key-LISTVAL Trigger: List_Values. paramtype VARCHAR2. Data type – char – 2555 char maximum Global variables are visible across multiple forms Parameter values are not visible across multiple forms. its type.PROCEDURE DESTROY_PARAMETER_LIST (list VARCHAR2) Deletes a dynamically created parameter list and all parameters it contains. using a Key-LISTVAL trigger allows you to add subsequent PL/SQL statements that execute after the LOV is displayed. It can also passed between different oracle products. is of little value since it merely duplicates default Form Builder functionality. Types 1. . 2. END IF. However. 3. key 4. or the VARCHAR2 name of the parameter list.id IS NULL THEN Go_Item ('customer.Shik Mahamood Ali 22 Key-LISTVAL Trigger: List_Values. Adds parameters to a parameter list. list or name Specifies the parameter list. paramtype NUMBER. In the following example. key VARCHAR2. Data Parameter It is name of the record group present in the current form. either by list ID or name. 2. The data type of the key is VARCHAR2. Creates a parameter list with the given name.CREATE_PARAMETER_LIST (name VARCHAR2). The value of the text parameter is a character string. But not between forms. 5. Returns the current value and type of an indicated parameter in an indicated parameter list. as written. VARCHAR2). Each parameter consists of a key. The actual parameter can be either a parameter list ID of type PARAMLIST. key VARCHAR2. PARAMETER LIST List of Parameter or list that contains parameter names and their values Input values required for a form as startup are provided by parameters. GET_PARAMETER_ATTR (list VARCHAR2.value VARCHAR2). Parameter – Built Ins 1. IF :customer. The name of the parameter. It is passed between oracle products. and an associated value.id'). ADD_PARAMETER (list VARCHAR2. This trigger. DELETE_PARAMETER (list VARCHAR2. Text Parameter It is passed between forms.
The application looks for the module or document in the default paths defined for the called product. RUN_PRODUCT built-in Invokes one of the supported Oracle tools products and specifies the name of the module or module to be run. execmode. or the VARCHAR2 name of the parameter list. execmode. TEXT_PARAMETER Indicates that the parameter's value is an actual data value.list. Oracle Graphics display. GRAPHICS specifies Oracle Graphics. location.SET_PARAMETER_ATTR (list PARAMLIST. document. or Oracle Book document. If the parameter is a text parameter. Form Builder returns a message to the end user. . the value is the name of a record group.Shik Mahamood Ali 23 list or name Specifies the parameter list to which the parameter is assigned. paramtype NUMBER) Sets the type and value of an indicated parameter in an indicated parameter list. 6. display). and cannot be an expression. The actual parameter can be either a parameter list ID of type PARAMLIST. ASYNCHRONOUS specifies that control returns to the calling application immediately. If the called product is unavailable at the time of the call. The operator cannot work in the form while the called product is running. Executing the parameter sets the value of the variable to one of the following numeric constants: DATA_PARAMETER Indicates that the parameter's value is the name of a record group.name. Key The VARCHAR2 name of the parameter. the value is an actual text parameter. Syntax: RUN_PRODUCT( product. Value An OUT parameter of type VARCHAR2. even if the called application has not completed its display. commmode. If the parameter is a data type parameter. document Specifies the CHAR name of the document or module to be executed by the called product. BOOK specifies Oracle Book. display). REPORTS specifies Oracle Reports. Valid numeric constants for this parameter are SYNCHRONOUS and ASYNCHRONOUS. location. commmode. RUN_PRODUCT( product. commmode Specifies the communication mode to be used when running the called product. SYNCHRONOUS specifies that control returns to Oracle Forms only after the called product has been exited. Valid values are the name of a form module. document. key VARCHAR2. The actual parameter you supply must be a variable of type NUMBER. product Specifies a numeric constant for the Oracle product you want to invoke: FORMS specifies a Runform session. Paramtype An OUT parameter of type NUMBER. report.
item_name. passing the ** data in record group ’EMP_RECS’ to substitute ** for the report’s query named ’EMP_QUERY’.5 report. When you run Oracle Reports and Oracle Graphics. /* ** If it does. Valid numeric constants for this parameter are BATCH and RUNTIME. always set execmode to RUNTIME. or graph) generated by Oracle Graphics. BEGIN /* ** Check to see if the ’tmpdata’ parameter list exists. bar chart. Data passing is supported only for master queries. When you run Oracle Forms.Shik Mahamood Ali execmode 24 Specifies the execution mode to be used when running the called product. display Specifies the CHAR name of the Oracle Forms chart item that will contain the display (such as a pie chart. then delete it before we create it again in ** case it contains parameters that are not useful for our ** purposes here. */ pl_id := Get_Parameter_List(’tmpdata’). parameter lists that contain parameters of type DATA_PARAMETER (pointers to record groups) can only be passed to Oracle Reports and Oracle Graphics in SYNCHRONOUS mode. To specify a parameter list ID. (SYNCHRONOUS mode is required when invoking Oracle Graphics to return an Oracle Graphics display that will be displayed in a form chart item. either the file system or the database. the ID of the parameter list. The name of the chart item must be specified in the format block_name. (This parameter is only required when you are using an Oracle Graphics chart item in a form. Example: /* ** Built–in: RUN_PRODUCT ** Example: Call an Oracle Reports 2. use a variable of type PARAMLIST.) Note: You can pass text parameters to called products in both SYNCHRONOUS and ASYNCHRONOUS mode. execmode can be either BATCH or RUNTIME. location Specifies the location of the document or module you want the called product to execute. ** Presumes the Emp_Recs record group already ** exists and has the same column/data type ** structure as the report’s Emp_Query query. list or name Specifies the parameter list to be passed to the called product. Valid constants for this property are FILESYSTEM and DB. or NULL. */ PROCEDURE Run_Emp_Report IS pl_id ParamList. */ . Valid values for this parameter are the CHAR name of the parameter list. Note: You cannot pass a DATA_PARAMETER to a child query in Oracle Reports. However.) Note: You can prevent Oracle Graphics from logging on by passing a parameter list that includes a parameter with key set to LOGON and value set to NO.
. Example: /* ** Built–in: DELETE_PARAMETER ** Example: Remove the ’NUMBER_OF_COPIES’ parameter from the ** already existing ’TEMPDATA’ parameter list. BEGIN pl_id := Get_Parameter_List(pl_name).’number_of_copies’. Signal an error ** if the list already exists or if creating the ** list fails. END IF. passing the parameter list */ Run_Product(REPORTS. */ pl_id := Create_Parameter_List(’tmpdata’). /* ** Add a data parameter to this parameter list that will ** establish the relationship between the named query ** ’EMP_QUERY’ in the report. /* ** Run the report synchronously. END IF. IF Id_Null(pl_id) THEN pl_id := Create_Parameter_List(pl_name). Example: /* ** Built–in: CREATE_PARAMETER_LIST ** Example: Create a parameter list named ’TEMPDATA’.Shik Mahamood Ali 25 IF NOT Id_Null(pl_id) THEN Destroy_Parameter_List( pl_id ). and the record group named ** ’EMP_RECS’ in the form. ELSE Message(’Parameter list ’||pl_name||’ already exists!’). /* ** Create the ’tmpdata’ parameter list afresh. */ Add_Parameter(pl_id. ’dept_recordgroup’).’19’). END IF. ’dept_query’. IF Id_Null(pl_id) THEN Message(’Error creating parameter list ’||pl_name).TEXT_PARAMETER.DATA_PARAMETER. */ DECLARE pl_id ParamList. */ DECLARE pl_id ParamList. First ** make sure the list does not already exist. Example: /* ** Built–in: ADD_PARAMETER ** Example: Add a value parameter to an existing Parameter ** List ’TEMPDATA’. END IF. END.FILEYSTEM. END. DATA_PARAMETER. NULL). pl_name VARCHAR2(10) := ’tempdata’.’EMP_RECS’). RAISE Form_Trigger_Failure. SYNCHRONOUS. RUNTIME. END. BEGIN pl_id := Get_Parameter_List(’tempdata’). then ** attempt to create a new list. IF NOT Id_Null(pl_id) THEN Add_Parameter(pl_id. pl_id. Add_Parameter(pl_id. RAISE Form_Trigger_Failure.’EMP_QUERY’. then add a data parameter to ** the list to associate named query ’DEPT_QUERY’ ** with record group ’DEPT_RECORDGROUP’. ’empreport’.
–– FILESYSTEM. END. ’the_Where_Clause’. passing parameters in the ** parameter list. BEGIN pl_id := Get_Parameter_List(’tempdata’). END IF. END IF. wc VARCHAR2(2000). /* ** Launch the report. Example 2: PROCEDURE Run_Report_For_Last_Query IS pl ParamList.’number_of_copies’). */ IF wc IS NOT NULL THEN Add_Parameter(pl. Example: /* ** Built–in: DESTROY_PARAMETER_LIST ** Example: Remove the parameter list ’tempdata’ after first ** checking to see if it exists */ DECLARE pl_id ParamList.rdf’. –– SYNCHRONOUS. End. */ Run_Product(REPORTS. add a text parameter to the parameter ** list to specify the parameter name and its ** value. IF NOT Id_Null(pl_id) THEN Destroy_Parameter_List(pl_id). /* ** Get the Where Clause from the Last Query ** using a user–defined function */ wc := Last_Where_Clause. –– /* Delete the parameter list */ Destroy_Parameter_List(pl). –– pl ). wc ). .Shik Mahamood Ali 26 */ BEGIN Delete_Parameter(’tempdata’. –– BATCH. /* ** If there is a Non–NULL Last Where clause to ** pass. TEXT_PARAMETER. In this case the report definition has ** a parameter named ’the_Where_Clause’ that ** it’s expecting. The The The The The The Product to call name of the report definition communications mode Execution Mode Location of the reports document Handle to the parameter list –– –– –– –– –– Handle to the ParamList Name of Parameter in the Report Type of Parameter String Value for Parameter END. –– The Where Clause to Pass BEGIN /* ** Create a parameter list for parameter passing */ pl := Create_Parameter_List(’tmp’). –– ’rep0058.
ename = 'smith' -. or item (as in the Pre.BLOCK_STATUS SYSTEM. SYSTEM.indirect reference 2. .System Variable It is used to track of runtime status condition. that the block contains only New records. and Block triggers).direct reference IF NAME_IN('emp.Empno' ). and on which master block of a master/detail relation. 3.ename') = 'smith' -. The value can be one of three character strings: CHANGED NEW QUERY Indicates Indicates Indicates retrieved that the block contains at least one Changed record. COPY(NAME_IN(source). VARIABLES It is used to store values from form items.MASTER_BLOCK to help an OnClear-Details trigger determine what type of coordination-causing operation fired the trigger. Destroy global variable System Variable 1.SYSTEM.and PostItem.BLOCK_STATUS represents the status of a Data block where the cursor is located. or the current data block during trigger processing. cur_val VARCHAR2(40).Local Variables The local variable is PL/SQL variable whose value is only accessible with in the trigger or user named sub Programs 2. erase(‘global.COORDINATION_OPERATION This system variable works with its companion SYSTEM.Shik Mahamood Ali 27 Referencing Form Builder items indirectly 1. Use the NAME_IN function to get the value of an item without referring to the item directly. that the block contains only Valid records that have been from the database. 'Emp.CURRENT_BLOCK s The value that the SYSTEM.CURRENT_BLOCK is the name of the block that Form Builder is processing or that the cursor is in. record.CURRENT_BLOCK system variable represents depends on the current navigation unit: If the current navigation unit is the block. the value of SYSTEM.a’). IF :emp. 2. destination). SYSTEM. Copy( cur_val.NAME_IN The NAME_IN function returns the contents of an indicated variable or item. Record.Global Variable Whose value is accessible to trigger and subprograms in any modules – limit – 255 char length 3.COPY built-in Copies a value from one item or variable into another item or global variable. 1.
9. where the input focus (cursor) is located.CURSOR_ITEM represents the name of the block and item. The value is always a character string. SYSTEM. and on which master block of a master/detail relation.CURRENT_DATETIME SYSTEM. Indicates that the form contains only New records.CURSOR_VALUE SYSTEM.CURRENT_BLOCK is NULL.and Post-Form triggers). .CURRENT_DATETIME is a variable representing the operating system date.MODE s SYSTEM.Shik Mahamood Ali 28 If the current navigation unit is the form (as in the Pre. The value is always a character string. The form contains at least one block with QUERY records and no blocks with CHANGED records. SYSTEM. 12. SYSTEM.Details trigger determine what type of coordination-causing operation fired the trigger.CURSOR_RECORD SYSTEM.CURRENT_FORM represents the name of the form that Form Builder is executing. The value of SYSTEM.COORDINATION_OPERATION to help an On-Clear.CURSOR_VALUE represents the value of the item where the cursor is located. 7. The value is always a character string. This number represents the record's current physical order in the block's list of records. Indicates that a query is open.FORM_STATUS represents the status of the current form.LAST_QUERY represents the query SELECT statement that Form Builder most recently used to populate a block during the current Runform session.CURSOR_ITEM SYSTEM.MASTER_BLOCK This system variable works with its companion SYSTEM. 4.MODE indicates whether the form is in Normal. 8.FORM_STATUS becomes CHANGED only after at least one record in the form has been changed and the associated navigation unit has also changed. The value can be one of three character strings: CHANGED Indicates that the form contains at least one block with a Changed record. SYSTEM. or Fetch Processing mode. SYSTEM. SYSTEM. SYSTEM.FORM_STATUS SYSTEM. the value of SYSTEM. 11. Enter Query. The value is always a character string. SYSTEM.CURRENT_FORM SYSTEM. 6.CURSOR_RECORD represents the number of the record where the cursor is located. SYSTEM. The value is always a character string. NEW QUERY 10. block.LAST_QUERY SYSTEM. item. The value is always a character string. The value is a CHAR string in the following format: DD-MON-YYYY HH24:MM:SS 5.
then moves the mouse the platform is not a GUI platform. SYSTEM.Shik Mahamood Ali NORMAL ENTER-QUERY QUERY 29 Indicates that the form is currently in normal processing mode. The value is always a character string.MOUSE_ITEM is NULL if: the mouse is not in an item the operator presses the left mouse button. 13. if the mouse is in Item1 in Block2. VISUAL ATTRIBUTES . There are 2 ways to creating property class a. PROPERTY CLASS This object is a named object that contains a list of properties and their associated settings.TRIGGER_BLOCK SYSTEM. The Property Palette is where you set the properties of objects you create in form and menu modules. Indicates that the form is currently in Enter Query mode.MOUSE_ITEM represents the name of that item as a CHAR value. An object based on a property class can inherit the settings of any property in the class that is appropriate for that object.RECORD_STATUS SYSTEM. The value is always a character string.ITEM1. SYSTEM. The value can be one of four character strings: CHANGED INSERT NEW QUERY Indicates that a queried record's validation status is Changed. Indicates that the record's validation status is New. it represents the item where the cursor was located when the trigger began. Indicates that the record's validation status is Changed and that the record does not exist in the database. Once you create a property class you can base other objects on it. b. When referenced in a key trigger. the value for SYSTEM. 15. The value is NULL if the current trigger is a Pre. SYSTEM.RECORD_STATUS represents the status of the record where the cursor is located. SYSTEM.ITEM) in the scope for which the trigger is currently firing. Property Window method Property class can not be change programmatically.or Post-Form trigger. Indicates that the record's validation status is Valid and that it was retrieved from the database. For example. 14. Indicates that the form is currently in fetch processing mode. meaning that a query is currently being processed.MOUSE_ITEM If the mouse is in an item. Object Navigator method.TRIGGER_ITEM SYSTEM.TRIGGER_BLOCK represents the name of the block where the cursor was located when the current trigger initially fired.MOUSE_ITEM is :BLOCK2. SYSTEM. SYSTEM. 16.TRIGGER_ITEM represents the item (BLOCK.
1. Default Editor Default editor is invoked at runtime. you can apply it to any object in the same module.EXE 2. When Visual Attribute Group is set to Default. the resource file in use. User-Named Editor A user-named editor has the same text editing functionality as the default editor. System Editor The system editor to be used is defined by the FORMS60_EDITOR environment variable. The editor specified must use the ASCII text format. including the type of object. much like styles in a word processing program. and font settings. The actual settings are determined by a combination of factors. color. A named visual attribute is a separate object in a form or menu module that defines a collection of visual attribute properties. Named Setting the Visual Attribute Group property to a named visual attribute defined in the same module specifies that the object should use the attribute settings defined for the named visual attribute.Shik Mahamood Ali 30 Visual attributes are the font. Custom When the attribute of an objects are changed at design tome. the individual attribute settings reflect the current system defaults. Once you create a named visual attribute. Form Builder determines its display size and position dynamically based on the size and position of the text item from which the editor was invoked. Background Color Fill Pattern. You create a user-named editor when you want to display the editor programmatically with SHOW_EDITOR. refer to the Form Builder documentation for your operating system. For information on environment variables and system editor availability. FORMS60_EDITOR = C:\WINDOWS\NOTEPAD. 3. Visual attribute name is connected to an object by setting visual attribute name property Set_item_property(‘text1’. Visual attributes can include the following properties: Font properties: Font Name. they are custom VAT 3. EDITOR This object enables the operator to edit text. or when you want to specify custom editor attributes such as scroll bar and title. Default Setting the Visual Attribute Group property to Default specifies that that the object should be displayed with default color. pattern. . 2. Font Weight Color and pattern properties: Foreground Color. There are three types of editor objects: default editor. system editor. Font Style. and the window manager. Font Size. Charmode Logical Attribute.current_record_attribute. Visual Attribute Types 1.’v1’). and user-named editor. and pattern properties that you set for form and menu objects that appear in your application's interface. White on Black It can be changed dynamically. Font Width.
14. y. IF ed_ok THEN :emp. Use the system editor if the user has ** checked the ”System_Editor” menu item under the ** ”Preferences” menu in our custom menu module. message_out. val. or the current system editor). Pass the contents of the :emp. Show_Editor( ed_id. IF itm_x_pos > 40 THEN . ed_ok BOOLEAN.Shik Mahamood Ali 31 SHOW_EDITOR(editor_name. /* ** Show the appropriate editor at position (10. Example: /* ** Built–in: EDIT_TEXTITEM ** Example: Determine the x–position of the current item ** then bring up the editor either on the left ** side or right side of the screen so as to not ** cover the item on the screen. result). */ DECLARE itm_x_pos NUMBER.X_POS). val VARCHAR2(32000). */ DECLARE ed_id Editor. END IF.CHECKED) = ’TRUE’ THEN ed_name := ’system_editor’.Cursor_Item. 10. SHOW_EDITOR takes message_in and message_out parameters that allow you to pass a text string in to the editor and to get the edited text string back when the operator accepts the editor.14) on the ** screen. mi_id MenuItem. ed_name VARCHAR2(40). width. message_in. ELSE ed_name := ’my_editor1’. BEGIN itm_x_pos := Get_Item_Property(:System. BEGIN mi_id := Find_Menu_Item(’PREFERENCES.comments := val. Example: /* ** Built–in: SHOW_EDITOR ** Example: Accept input from the operator in a user–defined ** editor. val. x. ed_ok). ed_id := Find_Editor( ed_name ). END. */ val := :emp. The SHOW_EDITOR procedure displays a user-named editor at the specified display coordinates.comments item ** into the editor and reassign the edited contents if ** ’ed_ok’ returns boolean TRUE. a user-named editor.SYSTEM_EDITOR’). height). IF Get_Menu_Item_Property(mi_id. END IF.comments. The EDIT_TEXTITEM procedure invokes the editor associated with the current text item in the form (the default editor. Edit_Textitem(x. y.
Stacked canvases obscure some part of the underlying content canvas. 4. you can create additional windows as needed by inserting them under the Windows node in the Object Navigator. tab canvases are displayed on top of a content canvas.Stacked Canvas A stacked canvas is displayed atop—or stacked on—the content canvas assigned to the current window. just under its menu bar. Dialog .Tab Canvas A tab canvas—made up of one or more tab pages —allows you to group and display a large amount of related information on a single dynamic Form Builder canvas object. and Vertical Toolbar. including canvases. A single form can include any number of windows.1. CANVAS 32 Edit_TextItem(1. You can create two types of toolbar canvases: horizontal or vertical. property_true). There are four types of canvas objects: Content. HIDE_VIEW('a_stack'). There are two window styles: Document Document Windows Document windows typically display the main canvases and work areas of your application where most data entry. Like stacked canvases. You must define at least one content canvas for each window you create. and data retrieval is performed.8). while vertical toolbars are displayed along the far left edge of a window. Edit_TextItem(60. visible. or SET_VIEW_PROPERTY('a_stack'. radio groups.1. A content canvas is the "base" view that occupies the entire content pane of the window in which it is displayed. or SET_VIEW_PROPERTY('a_stack'. Showing and hiding a canvas programmatically SHOW_VIEW('a_stack'). 3. This object represents a background entity on which you place interface items.8). 2. Tab pages (that collectively comprise the tab canvas) each display a subset of the information displayed on the entire tab canvas. such as check boxes. WINDOW A window is a container for all visual objects that make up a Form Builder application. property_false). and text items.Toolbar Canvas A toolbar canvas often is used to create toolbars for individual windows. While every new form automatically includes a default window named WINDOW1. partly obscuring it. You can display more than one stacked canvas in a window at the same time.Shik Mahamood Ali ELSE END. 1.20. END IF.20. Horizontal Toolbar. visible. and often are shown and hidden programmatically. Horizontal toolbar canvases are displayed at the top of a window.Content Canvas The most common canvas type is the content canvas (the default type). Stacked.
containers typically used for modal dialogs that require immediate user interaction. for example. . or iconify a modal window.Windows When-Window-Activated Window-Resized ALERT An alert is a modal window that displays a message notifying the operator of some application condition. Single Document Interface Although MDI is the default system of window management during Forms Runtime. you can layer modeless windows so that they appear either in front of or behind other windows. 2. Modeless Windows You can display multiple modeless windows at the same time. When-Window-Deactivated . All other windows in the application are either document windows or dialog windows. END. end users cannot resize. Window Modality 1. and end users can navigate freely among them (provided your application logic allows it). REPLACE_CONTENT_VIEW (window_name VARCHAR2. When-Window-Closed .'history').Modal Windows Modal windows are usually used as dialogs. On some platforms.Document windows always are displayed within the MDI application window frame. On some platforms. Multiple Document Interface MDI applications display a default parent window. determines whether Form Builder hides the window automatically when the end user navigates to an item in another window. modal windows are "always-on-top" windows that cannot be layered behind modeless windows. Hide on Exit property For a modeless window. Use alerts to advise operators of unusual situations or to warn operators who are about to perform an action that might have undesirable or unexpected consequences. Modal windows are often displayed with a platformspecific border unique to modal windows. REPLACE_CONTENT_VIEW built-in Replaces the content canvas currently displayed in the indicated window with a different content canvas. When- .Shik Mahamood Ali 33 Dialog Windows Dialog windows are free-floating. */ BEGIN Replace_Content_View('employee_status'. 2. and have restricted functionality compared to modeless windows. view_name VARCHAR2). Trigger . ** Built-in: REPLACE_CONTENT_VIEW ** Example: Replace the 'salary' view with the 'history' ** view in the 'employee_status' window. Form Builder also provides support for an SDI root window on Microsoft Windows. On most GUI platforms. scroll. called the application window. MDI and SDI windows 1.
END. the subprogram returns an alert ID. al_button Number. Define the variable with a type of Alert. ** Trigger: On-Error */ DECLARE err_txt VARCHAR2(80) := Error_Text.Shik Mahamood Ali 34 There are three styles of alerts: Stop. Using Object Groups • Blocks include: Items Item-level triggers Block-level triggers Relations • Object groups cannot include other object groups . Set_Alert_Property(al_id. Searches the list of valid alerts in Form Builder. err_txt ). SET_ALERT_BUTTON_PROPERTY(alert_id ALERT. al_button := Show_Alert( al_id ). BEGIN al_id := Find_Alert('My_Error_Alert'). al_id Alert. SET_ALERT_PROPERTY (alert_id ALERT. Each style denotes a different level of message severity. ** Built-in: SET_ALERT_PROPERTY ** Example: Places the error message into a user-defined alert ** named 'My_Error_Alert' and displays the alert. property NUMBER. FIND_ALERT (alert_name VARCHAR2). and Note. ID_NULL (Alert BOOLEAN). Message severity is represented visually by a unique icon that displays in the alert window. Object groups provide a way to bundle objects into higher-level building blocks that can be used in other parts of an application and in subsequent development projects. Displays the given alert. Caution. You must return the ID to an appropriately typed variable. OBJECT GROUPS An object group is a container for a group of objects. When the given alert is located. message SHOW_ALERT (alert_id Alert). You define an object group when you want to package related objects so you can copy or subclass them in another module. Changes the message text for an existing alert. Changes the label on one of the buttons in an alert. value VARCHAR2).property VARCHAR2.button NUMBER. Returns a BOOLEAN value that indicates whether the object ID is available. and returns a numeric value when the operator selects one of three alert buttons. You define an object group when you want to package related objects for copying or sub classing in another module. alert_message_text. VARCHAR2). You can use object groups to bundle numerous objects into higher-level building blocks that you can use again in another application.
unique version of that object in the target module. for a consistent look and feel • Reuse complex objects such as a Navigator Benefits of the Object Library • Simplifies the sharing and reuse of objects • Provides control and enforcement of standards • Eliminates the need to maintain multiple referenced forms SMARTCLASS . object groups. They simplify reuse in complex environments. An object library can contain simple objects. but they are protected against change in the library. maintain. • • • • Is a convenient container of objects for reuse Simplifies reuse in complex environments Supports corporate. Object libraries simplify the sharing of reusable components. and personal standards. Any objects owned by the copied object are also copied. such as buttons and items. project. project. Use copying to export the definition of an object to another module. by using Object Libraries. In addition. and program units.Shik Mahamood Ali 35 • Deleting: An object group does not affect the objects An object affects the object group Copying an Object Copying an object creates a separate. and they support corporate. Objects can be used as standards (classes) for other objects. You can use the Object Library to create. • Changes made to a copied object in the source module do not affect the copied object in the target module. and personal standards Simplifies the sharing of reusable components Object libraries are convenient containers of objects for reuse. and distribute standard and reusable objects. Subclassing Subclassing is an object-oriented term that refers to the following capabilities: • Inheriting the characteristics of a base class (Inheritance) • Overriding properties of the base class (Specialization) OBJECT LIBRARY This object provides an easy method of reusing objects and enforcing standards across the entire development organization. property classes. you can rapidly create applications by dragging and dropping predefined objects to your form. store. Reusing components enables you to: • Apply standards to simple objects.
Shik Mahamood Ali 36 A SmartClass is a special member of an Object Library. Reasons to share objects and code: Increased productivity Increased modularity Decreased maintenance Maintaining standards .PLL . A library: Is produced as a separate module and stored in either a file or the database Provides a convenient means of storing client-side code and sharing it among applications Means that a single copy of program units can be used by many form.MMB Menu Module Binary . END. report. • Is an object in an object library that is frequently used as a class • Can be applied easily and rapidly to existing objects • Can be defined in many object libraries You can have many SmartClasses of a given object PL/SQL Libraries A library is a collection of PL/SQL program units.PLX PL/SQL Library Module Binary PL/SQL Library Module Text PL/SQL Library Module Executable .menu. If you frequently use certain objects as standards. and packages. Unlike other Object Library members. BEGIN SELECT ename INTO v_ename FROM emp WHERE empno = bind_value. it can be used to subclass existing objects in a form using the SmartClass option from the right mouse button popup menu.PLD . You can mark many different objects that are spread across multiple object libraries as SmartClasses.MMX Menu Module Executable Form Builder Built-in Package . or graphic modules Supports dynamic loading of program units FUNCTION locate_emp(bind_value IN NUMBER) RETURN VARCHAR2 IS v_ename VARCHAR2(15). functions.MMT Menu Module Text . A single library can contain many program units that can be shared among the Oracle Developer modules and applications that need to use them. you can mark them as SmartClasses by selecting each object in the object library and choosing Object—>SmartClass. including procedures. RETURN(v_ename). and alerts. such as standard buttons. date items. Object Library members which are not SmartClasses can only be used to create new objects in form modules into which they are added.
Shik Mahamood Ali
EXEC_SQL Provides built-ins for executing dynamic SQL within PL/SQL procedures
VBX Provides built-ins for controlling and interacting with VBX controls; this package works only in a 16-bit environment and is provided for backward compatibility WEB Provides built-ins for the Web environment OLE2 Provides a PL/SQL API for creating, manipulating, and accessing attributes of OLE2 automation objects SUBPROGRAM A subprogram can be either a procedure or a function. Built-in subprograms are therefore called in two distinct ways: • Built-in procedures: Called as a complete statement in a trigger or program unit with mandatory arguments. • Built-in functions: Called as part of a statement, in a trigger or program unit, at a position where the function’s return value will be used. Again, the function call must include any mandatory arguments. TRIGGER Triggers are blocks of PL/SQL code that are written to perform tasks when a specific event occurs within an application. In effect, a Form Builder trigger is an event-handler written in PL/SQL to augment (or occasionally replace) the default processing behavior. Every trigger has a name, and contains one or more PL/SQL statements. A trigger encapsulates PL/SQL code so that it can be associated with an event and executed and maintained as a distinct object.
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. 3.Item Level The trigger belongs to an individual item and can only fore when this item is the current item. Trigger Properties
Execution Hierarchy property Specifies how the current trigger code should execute if there is a trigger with the same name defined at a higher level in the object hierarchy.
Shik Mahamood Ali The following settings are valid for this property:
Override 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. Before Specifies that the current trigger fire before firing the same trigger at the next-higher scope. This is known as "fire before parent" behavior. After Specifies that the current trigger fire after firing the same trigger at the next-higher scope. This is known as "fire after parent" behavior.
What are triggers used for?
Validate data entry Protect the database from operator errors Limit operator access to specified forms Display related field data by performing table lookups Compare values between fields in the form Calculate field values and display the results of those calculations Perform complex transactions, such as verifying totals Display customized error and information messages to the operator Alter default navigation Display alert boxes Create, initialize, and increment timers
Groups of triggers
When-triggers On-triggers Pre- and Post-triggers Key-trigger
Execute in addition to default processing Replace default processing Add processing before or after an event Change default processing assigned to a specific key
Trigger Categories Block-processing triggers o When-Create-Record o When-Clear-Block o When-Database-Record o When-Remove-Record
Shik Mahamood Ali Interface event triggers o When-Button-Pressed o When-Checkbox-Changed o When-Image-Activated o When-Image-Pressed o When-Radio-Changed o When-Timer-Expired o When –List-Changed o When –List-Activated o When –Tree-Note-Activated o When –Tree-Note-Expanded o When –Tree-Note-Selected o o o o o Key- [all] When-Window-Activated When-Window-Closed When-Window-Deactivated When-Window-Resized
Master-detail triggers o On-Check-Delete-Master o On-Clear-Details o On-Populate-Details Message-handling triggers o On-Error o On-Message Navigational triggers o Pre- and Post- Triggers o Pre-Form Pre-Block Pre-Record Pre-Text-Item Post-Text-Item Post-Record Post-Block Post-Form
When-New-Instance-Triggers When-New-Form-Instance When-New-Block-Instance When-New-Record-Instance When-New-Item-Instance
o o Pre-Query Post-Query
Shik Mahamood Ali Transactional triggers. o o o o o o o o o o o o o o o o o o o On-Count On-Delete. On-Insert. On-Lock. On-Logon. On-Logout. On-Select. On-Update. Post-Database-Commit. Post-Delete. Post-Forms-Commit. Post-Insert. Post – Select. Post-Update. Pre-Commit. Pre-Delete. Pre-Insert. Pre-Select. Pre-Update.
Validation triggers o o When-Validate-Item When-Validate-Record
Mouse Event Triggers o o o o o o o o When-Custom-Item-Event When-Mouse-Click When-Mouse-Double Click When-Mouse-Down When-Mouse-Enter When-Mouse-Leave When-Mouse-Move When-Mouse-Up
Key-Fn Trigger o A Key-Fn trigger fires when an operator presses the associated key. o Use Key-Fn triggers to create additional function keys for custom functions. Calling user-named triggers
A. BLOCK-PROCESSING TRIGGERS Block processing triggers fire in response to events related to record management in a block.
the value of SYSTEM. or data-driven default values that must be specified at runtime. BEGIN /* ** Default Invoice Due Date based on Customer's ** Net Days Allowed value from the Customer block. you might want to perform an automatic commit whenever this condition occurs. CLOSE ship_dflt. */ OPEN ship_dflt. For example. Used For • Perform an action whenever Form Builder attempts to create a new record in a block.Net_Days_Allowed. Because GET_RECORD_PROPERTY requires reference to a specific record. */ :Invoice. removes all records from the block. That is the trigger fires as soon as Form Builder determines through validation that the record should be processed by the next post or commit as an insert or update.RECORD_STATUS is unreliable because there is no current record. When-Database-Record Fires when Form Builder first marks a record as an insert or an update. 3. that is.Due_Date := SYSDATE + :Customer. For example.Ship_Method. and after the operator attempts to navigate out of the item. its value is always accurate. We could ** use SELECT. rather than design time.Shik Mahamood Ali 41 1. 2. /* ** Default the shipping method based on this customers ** preference.INTO. Fires In • CREATE_RECORD WHEN-CREATE-RECORD TRIGGER This example assigns data-driven or calculated default values without marking the record as changed. An alternative is to use GET_RECORD_PROPERTY to obtain the record status. For example. Fires In • • • CLEAR_BLOCK COUNT_QUERY ENTER_QUERY Clear_Block(No_Validate).Custid AND pref = 'SHIP'. When-Create-Record Fires when Form Builder creates a new record. In a When-Clear-Block trigger. to set complex.. when the operator presses the [Insert] key. When-Clear-Block Perform an action whenever Form Builder flushes the current block. FETCH ship_dflt INTO :Invoice. This generally occurs only when the operator modifies the first item in a record. Form Builder fires this trigger. END. DECLARE CURSOR ship_dflt IS SELECT val FROM cust_pref WHERE Custid = :Customer. but explicit cursor is more ** efficient. The When-Clear-Block trigger does not fire when Form Builder clears the current block during the CLEAR_FORM event. Used For • • Use a When-Clear-Block trigger to perform an action every time Form Builder flushes the current block. .. or navigates to the last record in a set while scrolling down. calculated. stored in a preference table.
Fires In • • CLEAR_RECORD DELETE_RECORD B.INTERFACE EVENT TRIGGERS Interface event triggers fire in response to events that occur in the form interface..Form_Status <> 'QUERY' THEN Message('Unable to commit order to database. When-Remove-Record Fires whenever the operator or the application clears or deletes a record. Initiate an action when the operator toggles the state of a check box. either with the mouse or through keyboard selection .Form_Status = 'CHANGED' THEN Commit_Form. When-Checkbox-Changed Fires when an operator changes the state of a check box. /* If the Form_Status is not back to 'QUERY' ** following a commit.'). Perform an action whenever a record is cleared or deleted. then the commit was not successful. Usage Notes • Use a When-Button-Pressed trigger to perform navigation. 2. block. like When-Window-Activated. or using the keyboard.Shik Mahamood Ali Used For • • 42 Perform an action whenever Form Builder changes a record's status to Insert or Update. 4. When-Button-Pressed Fires when an operator selects a button. such as When-Button-Pressed. BEGIN IF :System. or form level functionality. */ IF :System. This example executes a COMMIT_FORM if there are changes in the form. END IF. Some of these trigger. to calculate text item values. RAISE Form_Trigger_Failure. For example.. or using the keyboard. END IF. END. thus indicating that the record should be processed by the next COMMIT_FORM operation Use a When-Database-Record trigger to perform an action every time a record is first marked as an insert or an update. Others. can fire in response to both operator input and programmatic control. or for other item. 1. fire only in response to operator input or manipulation. by clicking with a mouse. either by clicking with the mouse. to adjust a running total that is being calculated for all of the records displayed in a block.
Usage Notes • Use a When-Image-Pressed trigger to perform an action when an operator clicks or double clicks on an image item. the value of the check box item remains as it was before the operator navigated to it. When-Image-Activated Initiate an action whenever the operator double-clicks an image item.’JPG’. then the Date_Shipped item is enabled. the When-Checkbox-Changed trigger is the first trigger to register the changed value of a check box item. End if. the internal value of that item does not change until navigation is completed successfully. When-Checkbox-Changed Trigger examples This trigger on the :S_ord.Update_allowed’. Begin READ_IMAGE_FILE(‘ST_’||TO_CHAR(:STMAST. • When an operator clicks in a check box. So for all navigation triggers that fire before the When-Checkbox-Changed trigger. Note : That When-Image-Pressed also fires on a double-click.STID)||’.JPG’. When-Image-Pressed Initiate an action whenever an operator clicks on an image item.date_shipped’. Begin If checkbox_checked(‘s_ord. End.order_filled item prevents the date_shipped item from being updated if the user marks the order as filled ( checked on ).Update_allowed’. .filled’) then Set_Item_Property(‘s_ord. Double-click on an image item. 4. Fires when an operator uses the mouse to: • Single-click on an image item. The above When_Image_Pressed trigger on the stimage item displays a image of the current student (in the stmast block) when the user clicks the image item.date_shipped’.property_true). Fires when an operator uses the mouse to: • Single-click on an image item • Double-click on an image item Note : That When-Image-Activated also fires on a double-click.’STMAST:STIMAGE’).If the check box is set off. Else Set_Item_Property(‘s_ord. 3. End.Shik Mahamood Ali Usage Notes • 43 Use a When-Checkbox-Changed trigger to initiate a task dependent upon the state of a check box.property_false). Thus.
6. Declare .) When an operator clicks an item in a radio group. the When-Radio-Changed trigger is the first trigger to register the changed value of a radio group. The display style of a list item is determined by the List Style property.Shik Mahamood Ali 44 5. if a When-List-Changed trigger is attached to a combo box style list item. In addition. When-Radio-Changed Description A fire when an operator selects a different radio button in a radio group. When no_data_found then Message(‘Invalid Student ‘). the value of the radio group remains as it was before the operator navigated to it. For all navigation triggers that fire before the When-Radio-Changed trigger. Usage Notes • Use a When-List-Changed trigger to initiate an action when the value of the list is changed directly by the end user. 7. operators use this technique in Enter Query mode to exclude a radio group from a query. Populate student name based on the selected student id. this trigger immediately confirms whether the customer has a good or excellent credit rating. If not. For example.Changed trigger will not fire if an end user duplicates the item using a key mapped to the DUPLICATE_ITEM built-in. or de-selects the currently selected radio button. The When-List-Changed trigger is not fired if the value of the list is changed programmatically such as by using the DUPLICATE_ITEM built-in. Usage Notes • A When-List-Activated trigger fires only for T-list style list items. • When-Radio-Changed Trigger examples When the user selects credit as the payment type for an order. then the payment type is set to cash. Begin Exception End. not for dropdown lists or combo box style list items. When-List-Activated Trigger Fires when an operator double-clicks on an element in a list item that is displayed as a T-list. or if the end user causes a procedure to be invoked which changes the value. When-List-Changed Trigger Description Fires when an end user selects a different element in a list item or de-selects the currently selected element. the internal value of that item does not change until navigation is completed successfully. (De-selecting a radio button in a radio group sets the radio group value to NULL. Usage Notes • Use a When-Radio-Changed trigger to perform an action depending on the state of a radio group. Thus. Select stname into :stname from the stmast where stid=:stid. or using the keyboard. the When-List. Initiate an action when an operator changes the current radio button selected in a radio group item. it fires each time the end user enters or modifies entered text. either by clicking with the mouse.
You can call GET_APPLICATION_PROPERTY(TIMER_NAME) in a When-Timer-Expired trigger to determine the name of the most recently expired timer.’EXCELLENT’) then :s_ord.'. Begin If :s_ord. DECLARE timer_id TIMER. 8. If v_credit NOT_IN(‘GOOD’. msg_1 VARCHAR2(80) := 'Wrap up the first phase of your presentation'. navigation. msg_2 VARCHAR2(80) := 'Move into your close.payment_type:=’CASH’. alert_id ALERT. The message box is displayed each time a repeating timer expires. BEGIN :GLOBAL. The following example is from a telemarketing application.custid.payment_type=’CREDIT’ then Select credit_rate into v_credit from customer where custid=:s_ord. When-Timer-Expired Description Fires when a timer expires. or transaction processing. or perform any task that should occur after a specified interval. message(‘Warning – Customer must pay cash‘). Use a When-Timer-Expired trigger to initiate an event. • The When-Timer-Expired trigger can not fire during trigger.credit_rate%type. End. Usage Notes Timers are created programmatically by calling the CREATE_TIMER built-in procedure. and message boxes are displayed to prompt the salesperson through each stage of the call. call_status NUMBER.timer_count := 1 BEGIN timer_id := FIND_TIMER('tele_timer'). End if.Shik Mahamood Ali 45 v_credit customer. IF :GLOBAL. one_and_half NUMBER(5) := (90 * 1000). alert_id := FIND_ALERT('tele_alert'). msg_3 VARCHAR2(80) := 'Ask for the order or repeat the close. Initiate an action when a programmatic timer expires. End if. • • Fires In • Process Expired Timer When-Timer-Expired Trigger examples Example The following example displays a message box each time a repeating timer expires.timer_count = 1 THEN . in which sales calls are timed.' two_minutes NUMBER(6) := (120 * 1000). update item values.
timer_count = 2. ELSIF call_status = ALERT_BUTTON2 THEN :GLOBAL. msg_1). Next_Record. This operation is independent of navigation to an item in the window. Next_Record. ELSE Set_Timer(timer_id. IF call_status = ALERT_BUTTON1 THEN Delete_Timer(timer_id). Usage Notes: Use this trigger to perform the following types of tasks: .timer_count := 0.timer_count = 2 THEN Change_Alert_Message(alert_id. two_minutes. IF call_status = ALERT_BUTTON1 THEN Delete_Timer(timer_id). NO_CHANGE. Fires when a window is made the active window. END IF.timer_count := 0. Next_Record. a window can be activated by. one_and_half. ALERT_MESSAGE_TEXT. call_status := Show_Alert(alert_id).timer_count := 0. END IF. :GLOBAL. END. call_status := Show_Alert(alert_id). NO_CHANGE). ELSIF call_status = ALERT_BUTTON2 THEN :GLOBAL.Shik Mahamood Ali 46 Set_Alert_Property(alert_id. msg_2). IF call_status = ALERT_BUTTON1 THEN Delete_Timer(timer_id). NO_REPEAT). When-Window-Activated Initiate an action whenever an operator or the application activates a window. call_status := Show_Alert(alert_id). navigating to an item in a different window always activates that window. 9. END IF. ELSE Change_Alert_Message(alert_id. Note that on some window managers. but window activation can also occur independently of navigation. msg_3). ELSE Set_Timer(timer_id. This occurs at form startup and whenever a different window is given focus. NO_CHANGE). ELSE Set_Timer(timer_id. Thus. say. END IF. ELSIF :GLOBAL. clicking on its title bar. ELSIF call_status = ALERT_BUTTON2 THEN :GLOBAL.
• You can close a window with the HIDE_WINDOW . 10 . 11. Usage Notes: Use this trigger to perform any one of the following types of tasks: • • • Capture the changed window properties. Set input focus in an item on the target window. Usage Notes: Use this trigger to audit the state of a window whenever the operator deactivates the window by setting the input focus in another window.EVENT_WINDOW to a variable or global variable. Fires when a window is resized. Fires when an operator deactivates a window by setting the input focus to another window. by way of the GET_WINDOW_PROPERTY built–in. Example: The following example of a call to SET_WINDOW_PROPERTY from this trigger closes a window whenever the operator closes it by way of the window manager operation: Set_Window_Property(’window_name’. Example: Begin GET_WINDOW_PROPERTY( window_name. . either by the operator or programmatically. such as width. When-Window-Deactivated Initiate an action whenever a window is deactivated as a result of another window becoming the active window. SET_WINDOW_PROPERTY.When-Window-Closed Initiate an action whenever an operator closes a window with the window manager's Close command. PROPERTY_OFF). 12. property). • Enforce navigation to a particular item whenever a window is activated. resizing the window programmatically fires the When–Window–Resized trigger.Shik Mahamood Ali 47 • Capture initial settings of window properties. • You can hide the window that contains the current item. Usage Notes: • Use this trigger to programmatically close a window when the operator issues the window–manager Close command. x coordinate. height. when the root window is first drawn. When-Window-Resized Initiate an action whenever a window is resized.) This trigger also fires at form startup. Audit the actions of an operator. End. It does not fire when a window is iconified. or y coordinate. • Keep track of the most recently fired window trigger by assigning the value from SYSTEM. and EXIT_FORM built–in subprograms. either by the operator or programmatically through a call to RESIZE_WINDOW or SET_WINDOW_PROPERTY. VISIBLE. (Even if the window is not currently displayed.
w NUMBER.WIDTH). h NUMBER. Key Triggers and Function Keys KEY TRIGGER Key–CLRBLK Key–CLRFRM Key–CLRREC Key–COMMIT Key–CQUERY Key–CREREC Key–DELREC Key–DOWN Key–DUP–ITEM Key–DUPREC Key–EDIT Key–ENTQRY Key–EXEQRY Key–EXIT Key–HELP Key–LISTVAL Key–MENU Key–NXTBLK Key–NXT–ITEM Key–NXTKEY Key–NXTREC Key–NXTSET Key–PRINT Key–PRVBLK Key–PRV–ITEM Key–PRVREC Key–SCRDOWN Key–SCRUP ASSOCIATED FUNCTION KEY [Clear Block] [Clear Form] [Clear Record] [Accept] [Count Query Hits] [Insert Record] [Delete Record] [Down] [Duplicate Item] [Duplicate Record] [Edit] [Enter Query] [Execute Query] [Exit] [Help] [List of Values] [Block Menu] [Next Block] [Next Item] [Next Primary Key] [Next Record] [Next Set of Records] [Print] [Previous Block] [Previous Item] [Previous Record] [Scroll Down] [Scroll Up] . w := Get_Window_Property(wn_id1. KEY.HEIGHT). For example. /* ** Resize Window2 to the same size */ Resize_Window( Window2. BEGIN /* ** Find Window1 and get it’s width and height. w. C. Example: /* ** Built–in: RESIZE_WINDOW ** Example: Set Window2 to be the same size as Window1 */ PROCEDURE Make_Same_Size_Win( Window1 VARCHAR2. END. Window2 VARCHAR2) IS wn_id1 Window. the trigger fires when operator presses a specific key or key-sequence.e. h := Get_Window_Property(wn_id1. you can define a Key-EXIT trigger to replace the default functionality of the [Help] key. */ wn_id1 := Find_Window(Window1). h ). i.Shik Mahamood Ali 48 • Maintain certain visual standards by resetting window size if the window was improperly resized. Replace the default function associated with a function key.[ALL] ( KEY TRIGGERS ) Key Triggers have a one-to-one relationship with specific keys.
These keys are referred to as Key–F0 through Key–F9. D. END.MASTER-DETAIL TRIGGERS Form Builder generates master/detail triggers automatically when a master/detail relation is defined between blocks. 1. On-Check-Delete-Master Fires when Form Builder attempts to delete a record in a block that is a master block in a master/detail relation. IF SHOW_ALERT (’question_alert’) = ALERT_BUTTON1 THEN EXIT_FORM. ALERT_MESSAGE_TEXT. You can attach Key–Fn triggers to 10 keys or key sequences that normally do not perform any Oracle Forms operations. Key–Others Trigger A Key–Others trigger fires when an operator presses the associated key. KEY-EXIT AT FORM LEVEL SET_ALERT_PROPERTY (’question_alert’. you or the DBA must use Oracle Terminal to map the keys to the appropriate functions. KEY-COMMIT TRIGGER AT FORM LEVEL: EMPLOYEES FORM BEGIN IF GET_APPLICATION_PROPERTY( CALLING_FORM ) IS NULL THEN COMMIT_FORM.Key–Fn Trigger A Key–Fn trigger fires when an operator presses the associated key. END IF. however. A Key–Others trigger is associated with all keys that can have key triggers associated with them but are not currently defined by function key triggers (at any level). A Key–Others trigger overrides the default behavior of a Runform function key (unless one of the following restrictions apply). Before you can attach key triggers to these keys. ’Do you really want to leave the form?’). • Perform one specific action whenever an operator presses any key. ELSE POST. The default master/detail triggers enforce coordination between records in a detail block and the master record in a master block. . When this occurs. END IF. KEY-DELREC TRIGGER ON S_CUSTOMER BLOCK DELETE_RECORD. use Key–Others triggers to perform the following tasks: • Disable all keys that are not relevant in a particular situation.Shik Mahamood Ali Key–UP Key–UPDREC 49 [Up] Equivalent to Record. Oracle Forms still displays the function key’s default entry in the Show Keys screen. Lock command on the default menu 1. Usage Notes: Use Key–Others triggers to limit an operator’s possible actions. 2. Specifically. Usage Notes: Use Key–Fn triggers to create additional function keys for custom functions.
• When Immediate coordination is set. In most cases. 3. • If you intend to manage block coordination yourself. this causes the details of the instantiated master to be populated immediately. On-Clear-Details Fires when Form Builder needs to clear records in a block that is a detail block in a master/detail relation because those records no longer correspond to the current record in the master block. Usage Notes Use an On–Error trigger for the following purposes: • • To trap and recover from an error To replace a standard error message with a custom message Use the ERROR_CODE. DBMS_ERROR_TEXT. or to trap and recover from an error. Message handling triggers fire in response to these default messaging events. 2.’). • When Deferred coordination is set and this trigger fires. IF the_sum <> :purchase_order. rather than to a block or item.Shik Mahamood Ali 50 DECLARE the_sum NUMBER. • Example: . RAISE Form_Trigger_Failure. Oracle Forms marks the blocks as needing to be coordinated. ERROR_TYPE. On-Error Replace a default error message with a custom error message. or DBMS_ERROR_CODE built–in function in an On–Error trigger to identify a specific error condition. Immediate coordination is the default. BEGIN SELECT SUM(dollar_amt) INTO the_sum FROM po_distribution WHERE po_number = :purchase_order. END IF.number.total THEN Message(’PO Distributions do not reconcile. Usage Notes: • Use an On–Populate–Details trigger when you have established a master–detail relationship and you want to replace the default populate phase of a query. Usage Notes: Oracle Forms creates the On–Clear–Details trigger automatically when you define a master– detail block relation. E. On-Populate-Details Fires when Form Builder needs to fetch records into a block that is the detail block in a master/detail relation so that detail records are synchronized with the current record in the master block. ERROR_TEXT. such as during a Commit process. On–Error triggers should be attached to the form. Trapping certain errors at the block or item level can be difficult if these errors occur while Oracle Forms is performing internal navigation. you can call the SET_BLOCK_PROPERTY(COORDINATION_STATUS) built–in. 1. END.MESSAGE-HANDLING TRIGGERS Form Builder automatically issues appropriate error and informational messages in response to runtime events.
Shik Mahamood Ali 51 The following example checks specific error message codes and responds appropriately. lv_errtyp VARCHAR2(3) := ERROR_TYPE.. ELSE Message(lv_errtyp||’–’||to_char(lv_errcod)||’: ’||lv_errtxt). lv_errtxt VARCHAR2(80) := MESSAGE_TEXT.. END IF. BEGIN IF lv_errcod = 40350 THEN alert_button := Show_Alert(’continue_alert’). RAISE Form_Trigger_Failure. . END IF. Usage Notes: Use an On–Message trigger for the following purposes: • To trap and respond to an informative message • To replace a standard informative message with a custom message • To exclude an inappropriate message Example: The following example responds to an error message by displaying an alert that gives the user a message and gives the user the choice to continue or to stop: DECLARE alert_button NUMBER. ELSIF (lv_errcod = 40zzz) THEN ** More tasks here */ ELSE Message(lv_errtyp||’–’||to_char(lv_errcod)||’: ’||lv_errtxt).. lv_errcod NUMBER := MESSAGE_CODE. to replace a default message issued by Form Builder with a custom message. for example.. lv_errtxt VARCHAR2(80) := ERROR_TEXT. END. ELSE . IF alert_button = ALERT_BUTTON1 THEN . RAISE Form_Trigger_Failure. END. DECLARE lv_errcod NUMBER := ERROR_CODE. 2. BEGIN IF (lv_errcod = 40nnn) THEN /* ** Perform some tasks here */ ELSIF (lv_errcod = 40mmm) THEN /* ** More tasks here */ . END IF.. lv_errtype VARCHAR2(3) := MESSAGE_TYPE. On-Message To trap and respond to a message..
1. RAISE Form_Trigger_Failure. This Post-Query trigger on the S_ORD block selects the total count of line items for the current Order.exact_match.lineitem_count FROM S_ITEM WHERE ord_id = :S_ORD. Fires once for each record fetched into the block. Post-Query Perform an action after fetching a record. END IF.name || ‘%’. Pre-Query Validate the current query criteria or provide additional query criteria programmatically. END IF. and displays this number as a summary value in the non base table item :Lineitem_count. • To test the operator’s query conditions. This trigger is defined at block level or above. Date Ordered. B] [ exact_match – Check Box User can specify if or not a query condition for a customer name should exactly match the table value.Ename IS NULL AND :Employee.id. Post-Query fires for each record that is fetched into the block as a result of a query. and to fail the query process if the conditions are not satisfactory for the application • To add criteria for the query by assigning values to base table items • A Pre-Query trigger fires before a query executes. Use Post-Query as follows: • To populate non database items as records are returned from a query • To calculate statistics • A Post-Query trigger fires as each record is fetched (except array processing). such as looking up values in other tables based on a value in the current record. Make sure the user has given one of the two Columns which we have indexed in their search criteria. just before sending the SELECT statement to the database. or Date Shipped.’). Use it to check or modify query conditions. otherwise fail the query with a helpful message A] IF :Employee. This Pre-Query trigger on the S_ORD block only permits queries if there is a restriction on either the Order ID.name:=’%’||:S_customer. 2.QUERY-TIME TRIGGERS 52 Query-time triggers fire just before and just after the operator or the application executes a query in a block. [ Set the initial value property to “Y”.’Y’)=’N’ then :S_Customer. ] IF nvl(:control. Begin End.Mgr IS NULL THEN Message(’Supply Employee Name and/or Manager Id ’||’for Query. Note that the trigger only fires on the initial fetch of a record not when a record is subsequently scrolled back into view a second or third time. SELECT COUNT(ord_id) INTO :S_ORD.Shik Mahamood Ali F. . This prevents attempts at very large queries. Use it to perform calculations and populate additional items.
END. FETCH lookup_area INTO :Employee. BEGIN /* Lookup the Payment Plan Description given the Payplan_Id in the Employee Record just fetched. Use Explicit ** Cursor for highest efficiency.TRIGGERS Fire as Form Builder navigates internally through different levels of the object hierarchy. Use it to perform calculations and populate additional items. navigational events occur as Form Builder moves the input focus from the current item to the target item.AND POST. but before the statement is actually issued.Payplan_Desc_Nondb. when the operator clicks on a text item in another block. /* ** Lookup Area Descript given the Zipcode in ** the Employee Record just fetched.Payplan_Id. What is a difference between pre-select and pre-query? Fires during the execute query and count query processing after oracle forms constructs the select statement to be issued.Zip.Shik Mahamood Ali 53 Example: This example retrieves descriptions for code fields. for display in non–database items in the current block. CLOSE lookup_payplan. For instance.Area_Desc_Nondb. ** Use Explicit Cursor for highest efficiency. A query fetched 10 records How many times does a PRE-QUERY Trigger and POST-QUERY Trigger will get executed? PRE-QUERY fires once. • • A Pre-Query trigger fires before a query executes. CLOSE lookup_area. FETCH lookup_payplan INTO :Employee. . CURSOR lookup_area IS SELECT Area_Name FROM Zip_Code WHERE Zip = :Employee. G.NAVIGATIONAL TRIGGERS Navigational triggers fire in response to navigational events. The pre-query trigger fires just before oracle forms issues the select statement to the database after the operator as define the example records by entering the query criteria in enter query mode. DECLARE CURSOR lookup_payplan IS SELECT Payplan_Desc FROM Payplan WHERE Payplan_Id = :Employee. Pre-query trigger fires before pre-select trigger. A Post-Query trigger fires as each record is fetched (except array processing). POST-QUERY fires 10 times. I ] PRE.*/ OPEN lookup_payplan. */ OPEN lookup_area. Use it to check or modify query conditions.
such as at form startup. What Happens When a Navigation Trigger Fails? If a Pre. Example The Pre-Text-Item trigger fires just before entering a text item.and Post.or Post navigation trigger fails. To the user.Shik Mahamood Ali 54 When Do Pre.and Post-Navigation Triggers Fire? The Pre. the input focus returns to its initial location (where it was prior to the trigger firing). Pre-Form Perform an action just before Form Builder navigates to the form from "outside" the form.and Post.navigation triggers fire during navigation.IS_ROLE_ENABLED(’TECHNICAL’) THEN MESSAGE(’You are not authorized to run this application’). IF not (DBMS_SESSION. When Do Navigation Triggers Not Fire? The Pre. For instance.IS_ROLE_ENABLED(’ADMINISTRATIVE’) or (DBMS_SESSION. 1. that is just before entry to or just after exit from the object specified as part of the trigger name. Pre. if the validation unit is Record.navigation triggers do not fire if they belong to a unit that is smaller than the current validation unit. it appears that the input focus has not moved at all. .and Post-Text-Item triggers do not fire.
based on other items previously entered into the same record. Usage Notes: . END IF. Post-Form Perform an action before Form Builder navigates to "outside" the form. RAISE form_trigger_failure. enabled. Pre-Block Perform an action before Form Builder navigates to the block level from the form level. 3. such as when exiting the form. 5.Record_Status = ’NEW’) THEN RAISE Form_Trigger_Failure. • Use a Pre–Record trigger to keep a running total. 55 2. Fires during the Leave the Form process.RECORD_STATUS evaluating to NEW. Fires during the Enter the Block process. 4. Pre-Record Perform an action before Form Builder navigates to the record level from the block level. The following trigger prevents the user from entering a new record given some dynamic condition and the status of SYSTEM. Usage Notes: • Fires during the Enter the Record process. and • store that value in a global variable or form parameter. Usage Notes: Use a Pre–Text–Item trigger to perform the following types of tasks: • Derive a complex default value. property_false).Shik Mahamood Ali PAUSE. END IF. Record the current value of the text item for future reference. when a form is exited. SET_ITEM_PROPERTY(’CONTROL. Usage Notes: Use a Pre–Block trigger to: • Allow or disallow access to a block • Set variable values Disabling stock_button when leaving CONTROL block: begin End.stock_button’. during navigation to a different record. during navigation from one block to another. Pre-Text-Item Perform an action before Form Builder navigates to a text item from the record level. IF (( dynamic–condition) AND :System.
Specifically. 7. the Post–Record trigger fires whenever the operator or the application moves the input focus from one record to another. Post-Block Manipulate the current record when Form Builder leaves a block and navigates to the form level. for example. Post-Record Manipulate a record when Form Builder leaves a record and navigates to the block level. lst_itm VARCHAR2(80). PREVIOUS_BLOCK. if you want to set a visual attribute for an item as the operator scrolls down through a set of records. that is.Cursor_Item.cmdsave’. 6. For example. CREATE_RECORD. This trigger does not fire when the form is exited abnormally. • To display a message to the operator upon form exit. Example: /* ** Built–in: NEXT_RECORD ** Example: If the current item is the last item in the ** block. enabled. use a Post–Form trigger to erase any global variables that the form no longer requires. NEXT_BLOCK. For example. property_false). NEXT_RECORD. including INSERT_RECORD.Shik Mahamood Ali 56 You can use a Post–Form trigger for the following tasks: • To clean up the form before exiting. if validation fails in the form. Example . ELSE Next_Item. BEGIN lst_itm := cur_blk||’. Set_item_property (‘control.’||Get_Block_Property(cur_blk. the record that had input focus when the Leave the Block event occurred. The Leave the Record process can occur as a result of numerous operations. IF cur_itm = lst_itm THEN Next_Record. then skip to the next record instead of ** the default of going back to the first item in ** the same block ** Trigger: Key–Next–Item */ DECLARE cur_itm VARCHAR2(80) := :System. Usage Notes: Use a Post–Record trigger when you want to perform an action whenever the operator or the application moves the input focus from one record to another. Usage Notes: • • Use a Post–Block trigger to validate the block’s current record. You might also use this trigger to test a condition and prevent the user from leaving a block based on that condition. you can do so from within this trigger. Fires during the Leave the Record process.LAST_ITEM). cur_blk VARCHAR2(80) := :System. etc.Cursor_Block. DELETE_RECORD.
EXECUTE_QUERY. When Do When-New. 1b.where_cls’). (Occurs after the Pre-Form trigger fires). 1c. ’'GLOBAL. DEFAULT_WHERE. When-New-Form-Instance Trigger at Form Level .height_win_order := GET_WINDOW_PROPERTY(’win_order’.width_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’.Shik Mahamood Ali END IF. BEGIN EXECUTE_QUERY. :GLOBAL. BEGIN DEFAULT_VALUE(’’. Specifically. 57 8. Fires during the Leave the Item process for a text item. END. Example The When-New-Item-Instance trigger fires immediately after navigation to a new instance of an item. :GLOBAL. END. by including the following code in your When-New-Form-Instance trigger: 1a.HEIGHT). EXECUTE_QUERY. these triggers fire just after Form Builder moves the input focus to a different item. Post-Text-Item Manipulate an item when Form Builder leaves a text item and navigates to the record level. 1.:GLOBAL. when the ORDERS form is run. END. When-New-Form-Instance Perform an action at form start-up.HEIGHT).“object”-Instance Triggers Fire? The When-New-”object”-Instance triggers fire immediately after navigation to the object specified as part of the trigger name. SET_BLOCK_PROPERTY(’prod_lov_blk’.WIDTH). II] WHEN-NEW-INSTANCE-TRIGGERS Fire at the end of a navigational sequence that places the input focus on a different item. Specifically. :GLOBAL.width_win_order := GET_WINDOW_PROPERTY(’win_order’. :GLOBAL. Perform a query of all orders. this trigger fires when the input focus moves from a text item to any other item. WIDTH).where_cls). 1d. when the form returns to a quiet state to wait for operator input.height_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’.
3. rg_emps RECORDGROUP. fires after the When-New-Block-Instance trigger.’select 1. If the new record is in a different block.htree3'). if one exists . v_ignore := Populate_Group(rg_emps). Then. Example The following example of a When-New-Block-Instance trigger conditionally sets the DELETE ALLOWED property to FALSE. rg_emps). For example.Set_Tree_Property(htree.Shik Mahamood Ali 58 BEGIN SET_WINDOW_PROPERTY( forms_mdi_window. in other words. Ftree. Example The Cursor arrives in each record of the S_Item block. when an operator presses [Down] to scroll through a set of records. ’Summit Sporting Goods Application’). Usage Notes: Use a When–New–Block–Instance trigger to perform an action every time Oracle Forms instantiates a new block. The example locates the hierarchical tree first. Usage Notes: Use a When–New–Record–Instance trigger to perform an action every time Oracle Forms instantiates a new record. END. 2. each time Oracle Forms instantiates a new record in the block. a record group is created and the hierarchical tree is populated. When-New-Record-Instance Perform an action immediately after the input focus moves to an item in a different record. and populates the product_image item with a picture of the products. to_char(empno) ’ ||' from emp ' ||'connect by prior empno = mgr ' ||’start with job = ’’PRESIDENT’’’). When-New-Block-Instance Perform an action immediately after the input focus moves to an item in a block other than the block that previously had input focus. Example This code could be used in a WHEN-NEW-FORM-INSTANCE trigger to initially populate the hierarchical tree with data. Ftree. ename. Oracle Forms fires this trigger each time the input focus moves to the next record. PROPERTY_FALSE). TITLE. END. but before the When-New-Item-Instance trigger.RECORD_GROUP. WINDOW_STATE. rg_emps := Create_Group_From_Query('rg_emps'. BEGIN htree := Find_Item('tree_block. DECLARE htree ITEM. MAXIMIZE ). level. NULL. SET_WINDOW_PROPERTY( forms_mdi_window. IF GET_APPLICATION_PROPERTY(username) = ’SCOTT’ THEN SET_BLOCK_PROPERTY(’S_ITEM’.DELETE_ALLOWED. END IF. v_ignore NUMBER.
END IF. END.’S_ITEM. property_true).UPDATE_ALLOWED.date_shipped’. Specifically.order_filled’)THEN SET_ITEM_PROPERTY(’S_ORD.cancel_query = 'N'. 3.] BEGIN IF (:global. END. BEGIN IF TO_CHAR(:Emp. END IF. The When-New-Item-Instance trigger is especially useful for calling restricted (navigational) built-ins. :global.Job = ’CLERK’ THEN Break. Message(’This date must be of the form 01–MON–YY’). END.product_image’). Usage Notes Use a When-New-Item-Instance trigger to perform an action whenever an item gets input focus.’tiff’. fires after the When-New-Block-Instance trigger. 2] 1. 2] Built–in: CLEAR_ITEM . BEGIN IF :Emp.cancel_query = 'Y' and :system. If the new item is in a different block. it fires after navigation to an item. 4. Call_Form(’clerk_timesheet’). END IF. Begin Filename:=get_product_image(:S_ITEM.Example: Clear the current item if it does not represent ** the first day of a month. End if End.a Example: Brings up the debugging window for a particular ** value of the ’JOB’ item anytime the user changes records. 1] IF CHECKBOX_CHECKED(’S_ORD. Perform an action immediately after the input focus moves to a different item. END IF. Else Read_Image_File(filename.*/ BEGIN IF :Emp.Empno IS NOT NULL THEN . If Filename= ‘ No file’ then Null. 3].date_shipped’).PRODUCT_ID).Shik Mahamood Ali 59 1] Declare Filename varchar2(20). GO_ITEM(’S_ORD.When-New-Item-Instance Fires when the input focus moves to an item.’DD’) <> ’01’ THEN Clear_Item.mode = 'ENTER-QUERY') THEN Exit_Form. Break.Hiredate. when Form Builder is ready to accept input in an item that is different than the item that previously had input focus.
Clear_Block(No_Validate). The following trigger accomplishes that operation. and form levels.Required (if so. END. Assume that you want Oracle Forms to display an LOV when the operator enters query mode and the input focus is in a particular text item. Form Builder checks to see whether the record is valid. 4]. or default processing. then all records in the form are validated. Form Builder performs validation checks during navigation that occurs in response to operator input.Employee_Id := :Emp. all records below that level are validated. H. then Form Builder first performs standard validation checks to ensure that the value conforms to the item’s properties. programmatic control. End if.Shik Mahamood Ali 60 :Global. block. unless you have suppressed this action.Format mask . Validation occurs at item. BEGIN THEN IF :System. if present. • Block and form level: At block or form level.Mode = ’ENTER–QUERY’ IF NOT Show_Lov(’my_lov’) THEN RAISE Form_Trigger_Failure. and a When-Validate-Record trigger is then fired. Standard checks include the following: . then control is passed back to the appropriate level. such as a Commit operation. it is set to valid. END IF. then is the item null?) . • Validation happens when: – [Enter] Key or ENTER built-in is activated – Control leaves the validation unit due to navigation or commit Validation Process Form Builder performs a validation process at several levels to ensure that records and individual values follow appropriate rules. When Does Validation Occur? Form Builder carries out validation for the validation unit under the following conditions: .Range (Lowest-Highest Allowed Value) . These checks are carried out before firing any When-Validate-Item triggers that you have defined. VALIDATION TRIGGERS Validation triggers fire when Form Builder validates data in an item or record. For example. If an item has been changed and is not yet marked as valid. then the status of each item in the record is checked.Data type . If validation fails. If not. Validation occurs at: • Item level: Form Builder records a status for each item to determine whether it is currently valid. so that the operator can make corrections. END IF. record.EMPNO’ and :System. if you commit (save) changes in the form.Validate from List (see later in this lesson) • Record level: After leaving a record.Cursor_Item = ’EMP.Empno. END. When the record passes these checks.
The following events then occur. depending on the circumstances: • If the value in the text item matches one of the values in the first column of the LOV. If validation succeeds. Using LOVs for Validation When you attach an LOV to a text item by setting the LOV property of the item. Usage Notes • Use a When-Validate-Item trigger to supplement Form Builder default item validation processing. • The Defer_Required_Enforcement property postpones enforcement of the Required property from item validation to record validation. then the full LOV contents are displayed to the operator. The validation unit is discussed in the next section. Specifically. • If the item value causes multiple records to be found in the LOV. by default Form Builder will not allow navigation out of the item until a valid value is entered. validation succeeds. and processing continues normally. Do this by setting the Validate from List property to Yes for the item.Shik Mahamood Ali 61 • The [Enter] key is (ENTER command is not necessary mapped to the key that is physically labeled Enter) pressed or the ENTER built-in procedure is run (whose purpose is to force validation immediately). When an item has the Required property set to Yes. • The operator or a trigger navigates out of the validation unit. • If no match is found. it does make it possible for your application to commit an invalid value to the database. The default validation unit is item. When – Validate -Item Fires during the Validate the Item process. then the full LOV column value is returned to the item (providing that the item is defined as the return item in the LOV). it fires as the last part of item validation for items with the New or Changed validation status. you can optionally use the LOV contents to validate data entered in the item. The trigger fires after standard item validation. When-Validate-Item Trigger You have already used this trigger to add item-level validation. block. Form Builder marks the changed item as Valid and does not re-validate it. Example . The item then passes this validation phase. Form Builder displays the LOV and uses the text item value as the search criteria to automatically reduce the list. the LOV is not displayed. While this behavior is necessary to avoid validation loops. Validation Triggers • Item level When-Validate-Item • Block level When-Validate-Record 1. but is a partial value of the LOV value. • If the item’s value causes a single record to be found in the LOV. Form Builder then automatically uses the item value as a non case-sensitive search string on the LOV contents. so that the operator must choose. or form by the designer. and input focus is returned to the item if the trigger fails. but can also be set to record. At validation time. This includes when changes are committed. • It is possible to write a When-Validate-Item trigger that changes the value of an item that Form Builder is validating. Setting the Defer_Required_Enforcement property to Yes allows the operator to move freely among the items in the record.
/* Method 1: Hardcode the item names into the trigger.Data_Found THEN Message('Invalid Commission Plan. Because Form Builder has already checked that required items for the record are valid. When – Validate -Record Fires during the Validate the Record process. it does make it possible for your application to commit an invalid value to the database. While this behavior is necessary to avoid validation loops. This implies PL/SQL may attempt to fetch data twice from the table in question to insure that there aren't two matching rows. Use a When-Validate-Record trigger to supplement Form Builder default record validation processing.End_Date THEN Message('Your date range ends before it starts!'). WHEN Too_Many_Rows THEN Message('Error.Commplan_Desc FROM commplan WHERE commcode = :Employee. Specifically. Duplicate entries in COMMPLAN table!'). you can use this trigger to perform additional checks that may involve more than one of the record’s items. When-Validate-Record Trigger This trigger fires after standard record-level validation. RAISE Form_Trigger_Failure. END.Shik Mahamood Ali 62 The SELECT. it fires as the last part of record validation for records with the New or Changed validation status. 2. END.Start_Date > :Experiment. If validation succeeds. Note that it is possible to write a When-Validate-Record trigger that changes the value of an item in the record that Form Builder is validating. Example The following example verifies that Start_Date is less than End_Date. RAISE Form_Trigger_Failure. the chance this code will ** be reusable in other forms we write is pretty low because of dependency on block and item ** names. rather than check each item separately. I. when the operator has left a new or changed record.Commcode. Transaction processing includes two phases: • Post: – Writes record changes to base tables – Fires transactional triggers • Commit: Performs database commit .*/ BEGIN IF :Experiment..TRANSACTIONAL TRIGGERS Transactional triggers fire in response to a wide variety of events that occur as a form interacts with the data source. EXCEPTION WHEN No.. This code presumes both date items are mandatory and that neither will be NULL. Use <List> for help').INTO statement must return an error if more than one row is retrieved that matches the criteria. Since these two text items have values that are related. in the order they were entered. BEGIN SELECT description INTO :Employee. Form Builder marks the record and all of the fields as Valid and does not re-validate. RAISE Form_Trigger_Failure. END IF. ** Structured this way. When-Validate-Record must be defined at block level or above. it's more convenient to check the combination of them once at the record level.
7 Fire the Post-Database-Commit trigger. before base table blocks are processed. implement foreign-key delete rule Fires during the Post and Commit Transactions process. Check the record uniqueness Update the row in the base table or fire the On-Update trigger. .Delete the row from the base table or fire the On-Delete trigger. For all inserted or updated records of the block in sequential order: If it is an inserted record: . For all deleted records of the block (in reverse order of deletion): .Fire the Post-Insert trigger. 5 Fire the Post-Forms-Commit trigger.Fire the Pre-Insert trigger. Commit Triggers Uses 1. Pre-Commit Check user authorization. Pre-Commit: Fires once if form changes are made or uncommitted changes are posted 2.Check the record uniqueness. If it is an updated record: Fire the Pre-Update trigger. fires if there are changes to base table items in the form or if changes have been posted but not yet committed (This trigger always fires in case of uncommitted posts. before a row is deleted.Shik Mahamood Ali Errors result in: • Rollback of the database changes • Error message The Commit Sequence of Events 63 The commit sequence of events (when the Array DML size is 1) is as follows: 1 Validate the form. It fires once for each record that is marked for delete. Usage Notes • Use a Pre-Delete trigger to delete the detail record of a master record. 4 Validate the block (for all blocks in sequential order).Insert the row into the base table or fire the On-Insert trigger. . Fire the Post-Update trigger. .Fire the Post-Delete trigger. set up special locking Pre-Commit Fires once during commit processing. Pre-Delete Journaling. such as setting up special locking requirements.Fire the Pre-Delete trigger. 3 Fire the Pre-Commit trigger. 2 Process save point. . If the current operation is COMMIT. . even if there are no changes to post. then: 6 Issue an SQL-COMMIT statement. .) Usage Notes: Use a Pre–Commit trigger to perform an action.Copy Value From Item. . anytime a database commit is going to occur.
CLOSE next_ord. ELSE CLOSE C1. • Use Post-Insert to update the sequence table. DECLARE CURSOR next_ord IS SELECT orderid_seq. check constraints Usage Notes: Use a Pre–Insert trigger to perform the following tasks: • change item values • keep track of the date a record is created and store that in the record prior to committing Example:1 This Pre-Insert trigger on the S_ORD block assigns an Order ID from the sequence S_ORD_ID. before a row is inserted. IF C1%FOUND THEN MESSAGE(’There are orders for this customer!’).id should be No. You can also assign sequence numbers from a table.id.Shik Mahamood Ali 64 • Use a Pre-Delete trigger to prevent the deletion of a record if that record is the master record for detail records that still exist. BEGIN /* ** Fetch the next sequence number from the ** explicit cursor directly into the item in ** the Order record. Note: The Insert Allowed and Keyboard Navigable properties on :S_ORD. Example:2 This example assigns a primary key field based on a sequence number. and then writes a row into an auditing table. automatically generated columns.OrderId. BEGIN OPEN C1. so that the user does not enter an ID manually. Pre-Insert Fires during the Post and Commit Transactions process. Could use SELECT. FETCH next_ord INTO :Order. Final checks before row deletion 3.INTO. It fires once for each record that is marked for insert.dual. */ OPEN next_ord. If you use this method. END IF.. journaling. which will be written to the ID column when the row is subsequently inserted.. END. PRE-DELETE TRIGGER -DECLARE CURSOR C1 IS SELECT ’anything’ FROM S_ORD WHERE customer_id = :S_CUSTOMER. End. flagging creation of a new order. /* ** Make sure we populated a new order id ok. FETCH C1 INTO :GLOBAL.NEXTVAL FROM dual. Generate sequence numbers. ** but explicit cursor is more efficient.nextval INTO :S_ORD.dummy... Begin SELECT S_ORD_ID. recording the new upper value for the sequence. then two transactional triggers are usually involved: • Use Pre-Insert to select the next available number from the sequence table (locking the row to prevent other users from selecting the same value) and increment the value by the required amount. */ . RAISE form_trigger_failure.id FROM SYS.
We could use SELECT. username. END. It fires once for each record that is marked for update. check constraints Usage Notes: Use a Pre–Update trigger to audit transactions. operation.oper_desc.g. implement foreign-key update rule.5% to 20%’ */ oper_desc := ’Changed Discount from ’|| TO_CHAR(old_discount)||’% to ’|| TO_CHAR(new_discount)||’%’. /* ** If the old and current values are different. /* ** Insert the audit record with timestamp and user */ INSERT INTO cust_audit( custid.Discount_Pct. We need to do this since the value of :Customer. DECLARE old_discount NUMBER.USER. Example: The following example writes a row into an Audit Table showing old discount and new discount for a given customer.. */ OPEN old_value.INTO but choose an explicit cursor for efficiency. timestamp ) VALUES ( :Customer.. before a row is updated. Pre-Update Fires during the Post and Commit Transactions process. ** ’Changed Discount from 13. BEGIN /* ** Fetch the old value of discount percentage from the database by CustomerId. Journaling.CustId. timestamp ) VALUES ( :Order.Discount_Pct will be the *new* value we’re getting ready to commit and we want to record for posterity the old and new values. END IF. 5. ’New Order’.SYSDATE ). username. 4.OrderId IS NULL THEN Message(’Error Generating Next Order Id’).Shik Mahamood Ali 65 IF :Order. auto-generated columns. new_discount NUMBER := :Customer. including timestamp and username making the change.SYSDATE ). RAISE Form_Trigger_Failure. CLOSE old_value. USER. END IF. END. /* ** Insert a row into the audit table */ INSERT INTO ord_audit( orderid. oper_desc VARCHAR2(80). On-Commit .OrderId.CustId. CURSOR old_value IS SELECT discount_pct FROM customer WHERE CustId = :Customer. operation. then we need to write out an audit record */ IF old_discount <> new_discount THEN /* Construct a string that shows the operation of Changing the old value to the new value. FETCH old_value INTO old_discount. e.
/* ** otherwise. it fires after the Pre–Delete trigger fires and before the Post–Delete trigger fires. BEGIN IF Get_Application_Property(DATA_SOURCE) = ’ORACLE’ THEN Commit_Form. . replacing the actual database delete of a given row. inserts the current record into the database during Post and Commit Transactions processing. inserts. END IF. BEGIN UPDATE emp SET termination_date = SYSDATE WHERE empno = :Emp. to delete a record from your form or from the database. Example: This example disables the commit operation when running against a datasource that does not support transaction control. If the application is running against ORACLE. • To perform the default processing from this trigger. Usage Notes • • Use an On-Insert trigger to replace the default Form Builder processing for handling inserted records during transaction posting. By default. include a call to the INSERT_RECORD built-in. and deletes have been posted to the database. the commit operation behaves normally. To perform the default Form Builder processing from this trigger. It fires once for each row that is marked for insertion into the database. END. To perform the default Oracle Forms processing from this trigger. include a call to the DELETE_RECORD built–in.Empno.Shik Mahamood Ali 66 Fires whenever Oracle Forms would normally issue a database commit statement to finalize a transaction. that is. The trigger fires once for each row that is marked for deletion from the database. On-Insert Fires during the Post and Commit Transactions process when a record is inserted. this operation occurs after all records that have been marked as updates. Specifically. This built-in is included primarily for applications that will run against a non-ORACLE datasource. Description When called from an On-Insert trigger. On-Delete Fires during the Post and Commit Transactions process. Example: This example updates the employee table to set the Termination_Date. Syntax PROCEDURE INSERT_RECORD. rather than actually deleting the employee from the database. 6. 7. Specifically. when Form Builder would normally insert a record in the database. it fires after the Pre-Insert trigger fires and before the Post-Insert trigger fires. call to the COMMIT_FORM built–in. Usage Notes: • • Use an On–Delete trigger to replace the default Oracle Forms processing for handling deleted records during transaction posting. no action is performed */ END. Usage Notes: • Use an On–Commit trigger to change the conditions of normal Oracle Forms commit processing to fit the particular requirements of a commit to a non–ORACLE database.
after the database commit occurs. 9. . END IF. DML Statements Issued During Commit Processing INSERT INTO base_table ( base_column. updates. End.WHERE ROWID = :ROWID DELETE FROM base_table WHERE ROWID = :ROWID DML Statements Issued During Commit Processing Rules: • DML statements may fire database triggers.. This builtin is included primarily for applications that run against a non-ORACLE data source. Usage Notes: • • Use an On–Update trigger to replace the default Oracle Forms processing for handling updated records during transaction posting. :base_item. On-Update Fires during the Post and Commit Transactions process.. base_column = :base_item. • Locking statements are not issued. Begin UPDATE RECORD... Post – Database Commit Description Fires once during the Post and Commit Transactions process. Specifically. initiates the default Form Builder processing for updating a record in the database during the Post and Commit Transaction process. END. Note that the Post-Forms-Commit trigger fires after inserts. it fires after the Pre–Update trigger fires and before the Post–Update trigger fires. .. • The Update Changed Columns Only and Enforce Column Security properties affect UPDATE statements. and deletes have been posted to the .) VALUES ( :base_item. ** Trigger: On-Insert */ BEGIN /* ** Check the global flag we setup at form startup */ IF :Global. • Form Builder uses and retrieves ROWID. include a call to the UPDATE_RECORD built–in. /* ** Otherwise. To perform the default Oracle Forms processing from this trigger. When called from an On-Update trigger.Shik Mahamood Ali 67 /* ** Built-in: INSERT_RECORD ** Example : Perform Form Builder standard insert processing ** based on a global flag setup at startup by the ** form..Using_Transactional_Triggers = 'TRUE' THEN User_Exit('my_insrec block=EMP'). */ ELSE Insert_Record. do the right thing. It fires once for each row that is marked for update in the form.. base_column.) UPDATE base_table SET base_column = :base_item. when Oracle Forms would normally update a record in the database. 8. perhaps based on a parameter.
such as updating an audit trail. */ BEGIN :Global.Did_DB_Commit := 'FALSE'. END.'Global. Post-Database-Commit Determines if commit was successful. Form Builder fires the Post-Forms-Commit trigger immediately. If the operator or the application initiates a Commit when there are no records in the form have been marked as inserts.Did_DB_Commit = 'FALSE'). 11. updates. Example /* ** FUNCTION recs_posted_and_not_committed ** RETURN BOOLEAN IS BEGIN Default_Value('TRUE'. END. RETURN (:System. without posting changes to the database. but before the transaction has been finalized by issuing the Commit. The Post-DatabaseCommit Trigger fires after Form Builder issues the Commit to finalize the transaction. Post – Delete Fires during the Post and Commit Transactions process. /* FUNCTION recs_posted_and_not_committed RETURN BOOLEAN IS BEGIN Default_Value('TRUE'. */ BEGIN :Global.Did_DB_Commit'). Usage Notes Use a Post-Database-Commit trigger to perform an action anytime a database commit has occurred.Form_Status = 'QUERY'AND :Global. form or block Usage Notes: .Did_DB_Commit := 'FALSE'. anytime a database commit is about to occur. determines if there are posted.Shik Mahamood Ali 68 database. RETURN (:System. If there are records in the form that have been marked as inserts. or deletes. Post-Forms-Commit Checks complex multirow constraints Example This example can be used in concert with the Post-Database-Commit trigger to detect if records have been posted but not yet committed. or deletes.Did_DB_Commit = FALSE').'Global. uncommitted changes 10.Did_DB_Commit'). after a row is deleted. updates. Post – Form . It fires once for each row that is deleted from the database during the commit process.Form_Status = 'QUERY' AND :Global. END.Commit Fires once during the Post and Commit Transactions process. Usage Notes • • Use a Post-Forms-Commit trigger to perform an action. END. the Post-Forms-Commit trigger fires after these changes have been written to the database but before Form Builder issues the database Commit to finalize the transaction.
End. It fires once for each record that is inserted into the database during the commit process.1 Begin . • • • Use a Post-Insert trigger to audit transactions. Example . after a row is updated. Post – Update Fires during the Post and Commit Transactions process. Usage Notes: Use a Post–Update trigger to audit transactions.insert_tot := TO_CHAR(TO_NUMBER(:GLOBAL. It fires once for each row that is updated in the database during the commit process. Else Messafe(SQL%rowcount|| “ rows Deleted”). END IF. Gather statistics on applied changes. Example . 13. End.Shik Mahamood Ali 69 Use a Post–Delete trigger to audit transactions.along with a time stamp and the user who performed the update.||SQLERRM).id. just after a record is inserted.id. LOG_USER) VALUES(:S_DEPT. USER ). IF SQL%NOTFOUND THEN MESSAGE(’Record not found in database’). who_did_it)VALUES ( :S_ORD. Example 1 Keeping an Audit Trail :GLOBAL.1 Begin INSERT INTO delete_audit (id. RAISE form_trigger_failure. EXCEPTION WHEN OTHERS THEN MESSAGE(’Error! ’. Post-Insert trigger: Begin INSERT INTO LOG_TAB (LOG_VAL.insert_tot)+1). This Post-Update trigger writes the current record ID to the UPDATE_AUDIT table. Example . Write changes to nonbase tables. Example 2 To handle exceptions. 12.id. Post – Insert Fires during the Post and Commit Transactions process.2 Begin Delete from S_ORD SET WHERE id = :S_ORD. SYSDATE. timestamp.username).:GLOBAL. End. include EXCEPTION section in trigger.
OrderId IS NULL THEN Message(’Error Generating Next Order Id’). timestamp ) VALUES ( :Order. flagging creation of a neworder. timestamp.id. Could use SELECT.Select Fires when Form Builder would normally execute the open cursor. End. who_did_it)VALUES ( :S_ORD. and then writes a row into an auditing table. username. use this trigger when you are retrieving data from a non-ORACLE data source. operation. */ OPEN next_ord. CLOSE next_ord.1 . IF :Order. DECLARE CURSOR next_ord IS SELECT orderid_seq. END IF.OrderId. • Example . /** Insert a row into the audit table INSERT INTO ord_audit( orderid. include a call to the SELECT_RECORDS built-in. Usage Notes • Use an On-Select trigger to open and execute the database cursor.id. but before it issues this statement Use a Pre-Select trigger to prepare a query prior to execution against a non-ORACLE data source. Note that the SELECT statement can be examined in a Pre-Select trigger by reading the value of the system variable SYSTEM.’New Order’. To perform the default Form Builder processing from this trigger. Specifically.. ** but explicit cursor is more efficient. BEGIN /** Fetch the next sequence number from the Explicit cursor directly into the item in the Order record. Pre – Select Fires during Execute Query and Count Query processing. parse.OrderId. but before the statement is actually issued.USER. FETCH next_ord INTO :Order. On-Select replaces open cursor.LAST_QUERY Fires after Form Builder has constructed the block SELECT statement based on the query conditions.SYSDATE ). IF SQL%NOTFOUND THEN MESSAGE(’Record not found in database’). to identify the records in the database that match the current query criteria. The On-Select trigger can be used in conjunction with the On-Fetch trigger to replace the processing that normally occurs in the EXECUTE_QUERY built-in subprogram. after Form Builder constructs the SELECT statement to be issued. Example . 15. and execute phases. and execute phases of a query..2 Begin UPDATE S_ORD SET date_shipped = SYSDATE WHERE id = :S_ORD. 70 INSERT INTO update_audit (id.Shik Mahamood Ali USER ).INTO. On . Query Processing Triggers Uses 14. RAISE Form_Trigger_Failure. END.NEXTVAL FROM dual. RAISE form_trigger_failure. SYSDATE. End. END IF. This example assigns a primary key field based on a sequence number. parse.
The trigger will fire once for each record that is to be fetched.) • On-Fetch continues to fire until: – It fires without executing CREATE_QUERIED_RECORD. ELSE /* ** Perform the default Form Builder task of opening the query. .EMPNO.ENAME. Create_Queried_Record.rowid := emprow. BEGIN FOR ctr IN 1.empno := emprow. */ EXIT WHEN NOT MyPackage. 15. Begin IF Get_Application_Property(DATASOURCE) = 'DB2' THEN User_Exit ( 'Query' ). the On-Select trigger is used to call a user exit. END IF.Shik Mahamood Ali 71 In the following example.j LOOP /* ** Try to get the next row. On–Fetch: DECLARE j NUMBER := Get_Block_Property(blk_name. On – Fetch Fires when Form Builder performs a fetch for a set of rows (You can use the CREATE_QUERIED_RECORD built-in to create queried records if you want to replace default fetch processing. or after the successful execution of the On-Select trigger.ename := emprow. RECORDS_TO_FETCH). */ Select_Records. End. emprow emp%ROWTYPE. – It raises FORM_TRIGGER_FAILURE. IF Form_Failure OR Form_Fatal THEN ABORT_QUERY. Usage Note: Use the Post-Select trigger to perform an action based on the outcome of the Select phase of query processing such as an action based on the number of records that match the query criteria. 'Query. IF form_fatal OR form_failure THEN raise form_trigger_failure. SELECT_RECORDS. :Emp. END LOOP.ROWID. :Emp. – The query is closed by the user or by ABORT_QUERY..Get_Next_Row(emprow). Post-Select Trigger Description Fires after Form Builder has constructed and issued the block SELECT statement. but before it fetches the records The Post-Select trigger fires after the default selection phase of query processing. It fires before any records are actually retrieved through fetch processing. :Emp. 16.' and a built-in subprogram. END IF. to perform a query against a database.
END. In such a case. Form Builder issues the standard query hits message: FRM-40355: Query will retrieve <n> records. • If you are replacing default processing. include a call to the built-in.1 This example calls a user-named subprogram to count the number of records to be retrieved by the current query criteria. Example 2 /* ** Built-in: COUNT_QUERY ** Example: Display the number of records that will be retrieved ** by the current query. Set_Block_Property('DEPT'. Usage Notes • Use an On-Count trigger to replace default Count Query processing in an application running against a non-ORACLE data source. Count_Query.Name_In('DEPT. • To perform the default Form Builder processing from this trigger. */ BEGIN END. END.j). perhaps based on a parameter. DECLARE j NUMBER. and sets the Query_Hits property appropriately. On – Count Fires when Form Builder would usually perform default Count Query processing to determine the number of rows that match the query conditions Fires when Form Builder would normally perform default Count Query processing to determine the number of rows in the database that match the current query criteria. * Trigger: On-Count */ . the message reports 0 records identified.QUERY_HITS. Example . BEGIN j := Recs_Returned('DEPT'. • Form Builder will display the query hits message (FRM-40355) even if the On-Count trigger fails to set the value of the Query_Hits block property. 72 16.DNAME')). When the On-Count trigger completes execution.Shik Mahamood Ali END IF. Example 3 /* ** Built-in: COUNT_QUERY ** Example: Perform Form Builder count query hits processing. you can set the value of the Query_Hits block property to indicate the number of records in the non-ORACLE data source that match the query criteria. Decide whether to use this Built-in or a user ** exit based on a global flag setup at startup by the form.
do the right thing. Replaces the default series of events that occurs when Form Builder interacts with the database to get the next value from a SEQUENCE object defined in the database. 17. Suppress or override this functionality with an On-Sequence-Number trigger. /* ** Otherwise. END IF. perhaps based on a parameter. do the right thing. */ Set_Block_Property(:System. Usage Notes • When a SEQUENCE is used as a default item value.On-Sequence-Number Trigger Description Fires when Form Builder would normally perform the default processing for generating sequence numbers for default item values. Form Builder queries the database to get the next value from the SEQUENCE whenever the Create Record event occurs. /* ** Otherwise.:control.Shik Mahamood Ali BEGIN 73 /* ** Check the global flag we set during form startup */ IF :Global.QUERY_HITS. /* ** Deposit the number of query hits in the appropriate ** block property so Form Builder can display its normal ** status message.Using_Transactional_Triggers = 'TRUE' THEN /* ** User exit returns query hits count back into the ** CONTROL. Example: /* ** Built–in: GENERATE_SEQUENCE_NUMBER ** Example: Perform Oracle Forms standard sequence number processing based on a global flag setup at ** startup by the form. */ ELSE Generate_Sequence_Number.HITS item. call the GENERATE_SEQUENCE_NUMBER built-in. */ ELSE END.Trigger_Block.hits). • To perform the default Form Builder processing from this trigger. . ** Trigger: On–Sequence–Number */ BEGIN /* ** Check the global flag we setup at form startup */ IF :Global.Using_Transactional_Triggers = ’TRUE’ THEN User_Exit(’my_seqnum seq=EMPNO_SEQ’). */ User_Exit('my_count'). Count_Query.
END. CLOSE chk_unique. close cursors. Form Builder displays message FRM-40600: Record has already been inserted. The On-Close trigger augments the normal Form Builder "close cursor" phase of a query. Form Builder always checks for unique primary key values.deptno. to close files. By default. checks the uniqueness of a record by constructing and executing the appropriate SQL statement to select for rows that match the current record's primary key values. 18. . The On-Close trigger fires automatically when the ABORT_QUERY built-in is called from an On-Select trigger. When a block has the PRIMKEYB property set to Yes. Replaces the default processing for checking record uniqueness. BEGIN OPEN chk_unique. and free memory. or when the operator or the application aborts the query. the On-Check-Unique trigger fires when Form Builder normally checks that primary key values are unique before inserting or updating a record in a base table. call the CHECK_RECORD_UNIQUENESS built-in. 19. On-Close Trigger Description Fires when an operator or the application causes a query to close. In the case of an update. IF tmp IS NOT NULL THEN Message('This department already exists. tmp VARCHAR2(1). Usage Notes To perform the default processing from this trigger. END IF.'). Form Builder.Shik Mahamood Ali END IF. by default. Form Builder checks for unique primary key values only if one or more items that have the Primary Key item property have been modified. For a record that has been marked for insert. If a duplicate row is found. Usage Notes • • Use an On-Close trigger after using the On-Select or On-Fetch triggers. It fires once for each record that has been inserted or updated. DECLARE CURSOR chk_unique IS SELECT 'x' FROM dept WHERE deptno = :dept. specifically. FETCH chk_unique INTO tmp. On-Check-Unique Trigger examples The following example verifies that the current record in question does not already exist in the DEPT table. END. RAISE Form_Trigger_Failure. On-Check-Unique Trigger 74 Description During a commit operation. Form Builder closes a query when all of the records identified by the query criteria have been fetched.
processing each block in sequence.Comm').on_or_off). 21. END.ENABLED. 20. ELSE on_or_off := PROPERTY_ON.Sal'). Form Builder makes the corresponding base table items in the form non-updateable by setting the Update Allowed item property Off dynamically.Shik Mahamood Ali 75 Example The following example releases memory being used by a user-defined data access method via the transactional triggers. on_or_off NUMBER. to roll back a . For columns to which the operator does not have update privileges. Set_Item_Property(itm_id. Set_Item_Property(itm_id. call the ENFORCE_COLUMN_SECURITY built-in.ENABLED. END IF.UPDATEABLE. itm_id := Find_Item('Emp. Set_Item_Property(itm_id.on_or_off). BEGIN IF NOT role_is_set('SUPERUSER') THEN on_or_off := PROPERTY_OFF.on_or_off). Set_Item_Property(itm_id. On-Rollback Trigger Description Fires when Form Builder would normally issue a ROLLBACK statement. By default. DECLARE itm_id Item. Only users with the user-defined SUPERUSER role can change these number fields.on_or_off). Form Builder enforces column security by querying the database to determine the base table columns to which the current form operator has update privileges. On-Column-Security Trigger Description Fires when Form Builder would normally enforce column-level security for each block that has the Enforce Column Security block property set On. END. BEGIN IF NOT my_data source_open('DX110_DEPT') THEN my_datasource_close('DX110_DEPT').UPDATEABLE. Usage Notes To perform the default processing from this trigger. Example The following example sets salary and commission text items in the current block to disabled and non-updateable. unless the SUPERUSER role is enabled. Form Builder performs this operation at form startup. END IF. itm_id := Find_Item('Emp.
** Decide whether to use this built-in based on a ** global flag setup at startup by the form. if you want to create an application that does not require a data source. include a call to the LOGON built–in. Usage Notes Use a Pre-Logon trigger to prepare the form for the logon procedure.Using_Transactional_Triggers = 'TRUE' THEN User_Exit('my_rollbk name='||sp_name). ** perhaps based on a parameter.Shik Mahamood Ali 76 transaction to the last savepoint that was issued. Usage Notes: Use an On–Logon trigger to initiate a logon procedure to a non–ORACLE data source. END. Usage Notes Use an On-Rollback trigger to replace standard Form Builder rollback processing. To perform default Form Builder processing from this trigger. DECLARE connected BOOLEAN:=FALSE. (NULL = Full Rollback)*/ sp_name := Get_Application_Property(SAVEPOINT_NAME). BEGIN /* Get the name of the savepoint to which Form Builder needs to ** rollback. On-Logon Trigger Fires once per logon when Oracle Forms normally initiates the logon sequence. To perform the default Oracle Forms processing from this trigger. ISSUE_ROLLBACK examples /* ** Built-in: ISSUE_ROLLBACK ** Example: Perform Form Builder standard Rollback processing. J. 2. ** Trigger: On-Rollback */ DECLARE sp_name VARCHAR2(80). . particularly to a nonORACLE data source. /* ** Check the global flag we setup at form startup */ IF :Global. END IF . You can supply a NULL command to this trigger to bypass the connection to a data source. include a call to the ISSUE_ROLLBACK built-in. • • • Pre–Logon and Post–Logon triggers fire as part of the logon procedure.LOGON TRANSACTION TRIGGERS 1. Pre-Logon Trigger Fires just before Form Builder initiate a logon procedure to the data source. ELSE Issue_Rollback(sp_name).
BEGIN 77 SET_APPLICATION_PROPERTY(CURSOR_STYLE. LOGON( un. which for security reasons is outside the database. RAISE FORM_TRIGGER_FAILURE. cs VARCHAR2(30). WHILE CONNECTED = FALSE AND tries > 0 LOOP LOGON_SCREEN. END IF. un NUMBER.’DEFAULT’). BEGIN END. IF NOT CONNECTED THEN MESSAGE(‘Too many tries’). END. pw:=GET_APPLICATION_PROPERTY( PASSWORD ). FALSE ). Tries:=tries-1. particularly a non-ORACLE data source. END LOOP.Shik Mahamood Ali tries NUMBER:=3. pw VARCHAR2(30). un:=GET_APPLICATION_PROPERTY( USERNAME ). IF FORM_SUCESS THEN Connected:=TRUE. pw || ‘@’ || CS . 4.'YYYYMMDDHH24MISS')). the results are undefined. the COPY built-in cannot be called from a Pre-Logout trigger . 3. POST-LOGON TRIGGER Description Fires after either of the following events: • • The successful completion of Form Builder default logon processing. Pre-Logout Trigger Fires once before Form Builder initiate a logout procedure. Example This example calls a user exit to log the current username and time to an encrypted audit trail file on the file system. The successful execution of the On-Logon trigger. Usage Notes • • Use a Pre-Logout trigger to prepare the form for logging out from the data source. cs:= GET_APPLICATION_PROPERTY( CONNECTION_STRING ). User_Exit('LogCrypt '|| USER||' ' ||TO_CHAR(SYSDATE. If you call certain built-ins from within one of the Logout triggers. For example. END IF.
When-Mouse-Click Trigger .Shik Mahamood Ali 78 because Pre-Logout fires after the Leave the Form event. the results are undefined. For example. END. Because the form is no longer accessible. BEGIN User_Exit(’LogCrypt ’||USER||’ ’ || TO_CHAR(SYSDATE. 5. a COPY operation is not possible. On-Logout Trigger Fires when Form Builder normally initiates a logout procedure from Form Builder and from the RDBMS. Post-Logout Trigger Description Fires after either of the following events: • • Form Builder successfully logs out of ORACLE. If you call certain built-ins from within one of the Logout triggers. a COPY operation is not possible. Usage Notes • • • Use an On-Logout trigger to replace the default logout processing either from the RDBMS or from a non-ORACLE data source. For example. the results are undefined. J.’YYYYMMDDHH24MISS’)). you cannot call COPY from a Pre-Logout trigger because Pre-Logout fires after the Leave the Form event. 6.MOUSE TRIGGERS 1. the COPY operation is not possible. you cannot call the COPY built-in from a Pre-Logout trigger because Pre-Logout fires after the Leave the Form event. Because the form is no longer accessible at this point. The successful execution of the On-Logout trigger. Usage Notes • Use a Post-Logout trigger to audit or to perform tasks on an Form Builder application that does not require or affect the RDBMS or other data source. This example calls a user exit to log the current username and time to an encrypted audit trail file on the file system. Because the form is no longer accessible. • If you call certain built-ins from within one of the Logout triggers. include a call to the LOGOUT built-in. which for security reasons is outside the database. To perform the default Form Builder processing from this trigger.
Usage Notes Use the When-Mouse-Click trigger to perform an action every time the operator clicks the mouse within an item and/or canvas. when the mouse is clicked within any canvas or item in the form if attached to a block.Shik Mahamood Ali Description 79 Fires after the operator click the mouse if one of the following events occurs: • • • if attached to the form. when the mouse is double-clicked within the item Six events must occur before a When-Mouse-DoubleClick trigger will fire: • • • • • • Mouse Mouse Mouse Mouse Mouse Mouse down up click down up double-click Any trigger that is associated with these events will fire before the When-Mouse-DoubleClick trigger fires. when the mouse is clicked within the item Three events must occur before a When-Mouse-Click trigger will fire: • • • Mouse down Mouse up Mouse click Any trigger that is associated with these events will fire before the When-Mouse-Click trigger fires. When-Mouse-DoubleClick Trigger examples Example . When-Mouse-DoubleClick Trigger Description Fires after the operator double-clicks the mouse if one of the following events occurs: • • • if attached to the form. 2. when the mouse is clicked within any item in the block if attached to an item. when the mouse is double-clicked within any canvas or item in the form if attached to a block. Usage Notes Use a When-Mouse-DoubleClick trigger to perform an action every time the operator DoubleClick the mouse within an item and/or canvas. when the mouse is double-clicked within any item in the block if attached to an item.
when the mouse is pressed down within any item in the block if attached to an item. Iconic buttons and items on the canvas below the initial window cannot be selected. when the mouse enters the item Usage Notes Use a When-Mouse-Enter trigger to perform an action every time the mouse enters an item or canvas. so the user is never able to click on those items. 4. Assume also that your application contains two canvases. When-Mouse-Enter Trigger Description Fires when the mouse enters an item or canvas if one of the following events occurs: • • • if attached to the form. when the mouse enters any canvas or item in the form if attached to a block. the trigger fires and returns focus to the previous target. However. when the mouse is pressed down within any canvas or item in the form if attached to a block. when the mouse is pressed within the item Usage Notes • Use a When-Mouse-Down trigger to perform an action every time the operator presses down the mouse button within an item and/or canvas. a product information window must appear. Canvas_One and Canvas_Two do not overlap each other. . For example. For example.Shik Mahamood Ali 80 Assume that an application requires Behavior A when the operator clicks the mouse and Behavior B when the operator double-clicks the mouse. Changing a tooltip's property in a When-Mouse-Enter trigger cancels the tooltip before it is ever shown. Note: The mouse down event is always followed by a mouse up event. If the operator double-clicks the mouse. 3. an online help window must appear. assume that the mouse has entered Canvas_One causing the When-Mouse-Enter trigger to fire which in turn causes Alert_One to appear. if the operator clicks the mouse. but appear side by side on the screen. as soon as the mouse enters that area. Canvas_One and Canvas_Two. Do not use the When-Mouse-Enter trigger on a canvas that is larger than the window. Be careful when calling a modal window from a When-Mouse-Enter trigger. Further. Finally. assume that your When-Mouse-Enter trigger causes Alert_One to appear whenever the mouse enters Canvas_One. when the mouse enters any item in the block if attached to an item. The user is able to scroll the canvas to see the items. assume that Alert_One displays within Canvas_Two's border. When-Mouse-Down Trigger Description Fires after the operator presses down the mouse button if one of the following events occurs: • • • if attached to the form. Doing so may cause the modal window to appear unnecessarily.
any When-Mouse-Leave triggers associated with this event will fire. when the mouse moves within any canvas or item in the form if attached to a block.Shik Mahamood Ali 81 When the operator dismisses the message box. WHEN-MOUSE-ENTER at Form Level begin IF :SYSTEM.CURSOR_ITEM. when the mouse leaves any canvas or item in the form if attached to a block. HIDE_VIEW(’cv_help’). when the mouse moves within any item in the block if attached to an item. Alert_One will appear again unnecessarily if the operator subsequently enters Canvas_One with the mouse. 5. WHEN-MOUSE-LEAVE trigger on control. The When-Mouse-Move trigger may have performance implications because of the number of times this trigger can potentially fire. 6. End. This may not be the desired behavior.id’). . When-Mouse-Move Trigger Description Fires each time the mouse moves if one of the following events occurs: • • • if attached to the form.save_item_name).MOUSE_CANVAS = ’CV_ORDER’ THEN :control. when the mouse leaves the item Usage Notes Use a When-Mouse-Leave trigger to perform an action every time the mouse leaves an item and/or canvas.show_help_button := ’?’. When-Mouse-Leave Trigger Description Fires after the mouse leave an item or canvas if one of the following events occurs: • • • if attached to the form. END IF. when the mouse moves within the item Usage Notes • Use the When-Mouse-Move trigger to perform an action every time the operator moves the mouse. In addition.save_item_name := :SYSTEM. when the operator moves the mouse out of Canvas_Two. End. begin :GLOBAL.show_help_button begin End. SHOW_VIEW(’cv_help’). GO_ITEM(’s_ord. GO_ITEM(:GLOBAL. when the mouse leaves any item in the block if attached to an item.
which is defined in a different document. If no such key . call the EXECUTE_TRIGGER built-in to execute a usernamed trigger. When more than one user-named trigger has the same name. User-Named Trigger A user–named trigger is a trigger that you define yourself in a form. and then call explicitly from other triggers or user–named subprograms. when the mouse up event is received within any canvas or item in form attached to a block. K.) In the menu PL/SQL. assume that there is a When-Mouse-Up trigger attached to Item_One.Shik Mahamood Ali 7. For example. the mouse up trigger will fire for Item_One. If the operator presses down the mouse on Item_One. rather than for Item_Two. DO_KEY built-in Executes the key trigger that corresponds to the specified built-in subprogram. when the mouse up event is received within any item in a block attached to an item. Create a user-named trigger to execute user-named subprograms defined in a form document from menu PL/SQL commands and user-named subprograms. Each user–named trigger defined at the same definition level must have a unique name. which in turn calls the user-named subprogram defined in the current form. but then releases the mouse on Item_Two. as shown here: Execute_Trigger(’my_user_named_trigger’).OTHER TRIGGERS 1. It is most practical to define user-named triggers at the form level. (User-named subprograms defined in a form cannot be called directly from menu PL/SQL. the scope of a user-named trigger is the definition level and below. As with all triggers. you must call the EXECUTE_TRIGGER built–in procedure. the trigger defined at the lowest level has precedence. Usage Notes User-named PL/SQL subprograms can be written to perform almost any task for which one might use a user-named trigger. The mouse up event is always associated with the item that received the mouse down event. Note: You can write user–named PL/SQL subprograms to perform almost any task for which you might use a user–named trigger. To execute a user–named trigger. when the mouse up event is received within an item Two events must occur before a When-Mouse-Up trigger will fire: • • Mouse down Mouse up Usage Notes Use the When-Mouse-Up trigger to perform an action every time the operator presses and releases the mouse. When-Mouse-Up Trigger 82 Description Fires each time the operator presses down and releases the mouse button if one of the following events occurs: • • • if a if if attached to the form.
Shik Mahamood Ali 83 trigger exists. Form Builder issues savepoints at form startup. Savepoint_Name returns the name of the savepoint to which Form Builder would roll back. Usage Notes To perform default Form Builder processing from this trigger. /* Otherwise. the On-Savepoint trigger never fires. */ ELSE . By default. Syntax PROCEDURE DO_KEY (built-in_subprogram_name VARCHAR2). In an On-Savepoint trigger. Suppress default savepoint processing by setting the Savepoint Mode form document property to Off. then the specified subprogram executes. Do_Key('Execute_Query'). This behavior is analogous to pressing the corresponding function key. /* ** Built-in: ISSUE_SAVEPOINT ** Example: Perform Form Builder standard savepoint processing.consequently. When Savepoint Mode is Off. Form Builder does not issue savepoints and.Using_Transactional_Triggers = 'TRUE' THEN User_Exit('my_savept name='||sp_name). the Savepoint_Name application property returns the name of the next savepoint that Form Builder would issue by default. not key names: DO_KEY(ENTER_QUERY). use the EXECUTE_TRIGGER built-in: EXECUTE_TRIGGER('KEY_F11').perhaps based on a parameter. BEGIN /* Get the name of the savepoint Form Builder needs to issue */ sp_name := Get_Application_Property(SAVEPOINT_NAME). /* Check the global flag we setup at form startup */ IF :Global. do the right thing. */ BEGIN END. In an On-Rollback trigger . and at the start of each Post and Commit Transaction process. ** Trigger: On-Savepoint */ DECLARE sp_name VARCHAR2(80). ** Decide whether to use this built-in based on a global flag setup at startup by the form. DO_KEY examples /* ** Built-in: DO_KEY ** Example: Simulate pressing the [Execute Query] key. include a call to the ISSUE_SAVEPOINT built-in. To accept a specific key name. On-Savepoint Trigger Fires when Form Builder would normally issue a Savepoint statement. DO_KEY restrictions DO_KEY accepts built-in names only. if no On-Savepoint trigger were present. 2.
/* ** Built-in: LOCK_RECORD ** Example: Perform Form Builder standard record locking on the queried record which has just been deleted or updated. for every row that is to be locked. END IF. Given such changes. if you are designing an application for use on a single–user system. If you want to circumvent this situation and effectively get rid of the Post-Change trigger.Shik Mahamood Ali Issue_Savepoint(sp_name). • Use this trigger to lock underlying tables for non–updateable views. The trigger fires between the key press and the display of the modified data. • To perform the default Oracle Forms processing from this trigger. The Post-Query trigger does not have the restrictions of the Post-Change trigger. use On–Lock if you are accessing a non–ORACLE data source directly. the trigger fires only the first time the operator tries to modify an item in the record. • When the On–Lock trigger fires as a result of an operator trying to modify data. you must include a Post-Query trigger in addition to your When-Validate-Item trigger.perhaps based on a parameter. Also. On-Lock Trigger Fires whenever Oracle Forms would normally attempt to lock a row. Its use is not recommended in new applications. END. Post-Change Trigger 84 Fires when any of the following conditions exist: • • • The Validate the Item process determines that an item is marked as Changed and is not NULL. 3. Form Builder fetches a non-NULL value into an item. the When-ValidateItem trigger does not fire. 3. Decide whether to use default processing or a user exit by consulting a global flag setup at startup by the form. Usage Notes: • Use an On–Lock trigger to replace the default Oracle Forms processing for locking rows. You can use Post-Query to make changes to the fetched database values. In this case. Usage Notes • • The Post-Change trigger is included only for compatibility with previous versions of Form Builder. you can use the On–Lock trigger to speed processing by bypassing all lock processing. In other words. and the item is not NULL. For example. An operator returns a value into an item by making a selection from a list of values. the trigger fires once. ** Trigger: On-Lock */ BEGIN . include a call to the LOCK_RECORD built–in. such as when an operator presses a key to modify data in an item. See "Usage Notes" below. Form Builder marks the corresponding items and records as changed. not by way of Open Gateway. The trigger does not fire during subsequent modifications to items in the same record.
8. DECLARE TabEvent varchar2(80). The system variable SYSTEM.Non_Oracle_Datasource = 'TRUE' THEN User_Exit('my_lockrec block=EMP'). 6. /* ** Otherwise. this occurs when a user presses the right mouse button. the query stored procedure has to use those values to filter the data. 5. Usage Notes When constructing a query.CUSTOM_ITEM_EVENT stores the case–sensitive name of the event that occurred. Example: This is an example of a procedure that can be called when Oracle Forms fires the When–Custom–Item–Event Trigger. TabNumber Number. Lock_Record. This trigger is called when a query operation is necessary. do the right thing. When-Custom-Item-Event Trigger Fires whenever a VBX control sends an event to Oracle Forms. Think of this as an On-Update trigger that is called by the system instead of doing default update operations. Update-Procedure Trigger Automatically created by Form Builder when the update data source is a stored procedure. 7. This trigger is called when a update operation is necessary. and the system variable SYSTEM.) Actions defined for this trigger are performed before the pop-up menu is displayed. (In a Microsoft Windows environment. Usage Notes: Use a When–Custom–Item–Event trigger to respond to a selection or change of value for a VBX control. Usage Notes Use this trigger to enable or disable menu items on a pop-up menu before it is displayed. */ ELSE END IF. This means that the enter query mode does not happen automatically unless you specify it. .Shik Mahamood Ali 85 /* ** Check the global flag we set up at form startup */ IF :Global. Query-Procedure Trigger Automatically created by Form Builder when the query data source is a stored procedure. but the Query Data Source Columns property must be set so that those items can be passed to the query stored procedure. Think of this as an On-Query trigger that is called by the system instead of doing default query operations. Pre-Popup-Menu Trigger This trigger is called when a user causes a pop-up menu to be displayed. END. any of the items may be used. Then.CUSTOM_ITEM_EVENT_PARAMETERS stores a parameter name that contains the supplementary arguments for an event that is fired by a VBX control.
it does not respond to implicit navigation. tp_id := FIND_TAB_PAGE(tp_nm). and use the user– defined Goto_Tab_Page procedure to navigate to the selected page. When-Tab-Page-Changed Fires whenever there is explicit item or mouse navigation from one tab page to another in a tab canvas. */ IF (UPPER(TabEvent) = ’CLICK’) THEN TabNumber := VBX. When-Form-Navigate Trigger Fires whenever any peer form navigation takes place.Shik Mahamood Ali 86 BEGIN TabEvent := :system.’CurrTab’). tp_id TAB_PAGE. topmost_tab_page). DECLARE win_id WINDOW := FIND_WINDOW(’WINDOW12’). the trigger will fire when the mouse or keyboard is used to navigate between tab pages. else SET_WINDOW_PROPERTY(win_id.WINDOW_STATE. form Use a When–Form–Navigate trigger to perform actions when any cross form navigation takes place without relying on window activate and window deactivate events.MINIMIZE). Goto_Tab_Page(TabNumber). • When-Tab-Page-Changed fires only when tab page navigation is explicit. 9. . For example. END.custom_item_event.WINDOW_STATE. Example /* Use a When-Tab-Page-Changed trigger to dynamically change a tab page's label from lowerto upper-case (to indicate to end users if they already have ** navigated to the tab page): */ DECLARE tp_nm VARCHAR2(30). Usage Notes • Use a When-Tab-Page-Changed trigger to perform actions when any tab page is changed during item or mouse navigation. end if. identify the ** tab selected. /* ** After detecting a Click event. tp_lb := GET_TAB_PAGE_PROPERTY(tp_id. 10. This is an example of a procedure that can be called when Oracle Forms fires the When–Form– Navigate Trigger. • When-Tab-Page-Changed does not fire when the tab page is changed programmatically. END.MAXIMIZE). BEGIN tp_nm := GET_CANVAS_PROPERTY('emp_cvs'.WINDOW_STATE) = ’MAXIMIZE’ THEN SET_WINDOW_PROPERTY(win_id.Get_Property(’TABCONTROL’. tp_lb VARCHAR2(30). but on different tab pages. END IF. label). but the trigger will not fire if an end user presses [Next Item] (Tab) to navigate from one field to another field in the same block. BEGIN if (GET_WINDOW_PROPERTY(win_id.
When-Tree-Node-Expanded Trigger Fires when a node is expanded or collapsed.TRIGGER_NODE is the node the user clicked on. Only end-user action will generate an event. text list. allowing the operator to view and select undisplayed values.TRIGGER_NODE returns a value of type NODE. a vertical scroll bar appears. When-Tree-Node-Selected Trigger Fires when a node is selected or deselected. a list of available choices appears. The combo box list item appears as an empty box with an icon to the right. 'VACATION'). Only end-user action will generate an event. SYSTEM. Usage Notes • • SYSTEM. . 12. or combo box DESCRIPTION Combo Box Appears initially as a single field (similar to a text item field).TRIGGER_NODE is the node the user clicked on. When-Tree-Node-Activated Trigger Fires when an operator double-clicks a node or presses Enter when a node is selected. Unlike the poplist or the text list style list items. 11. END. No programmatic action will cause the When-Tree-Node-Selected trigger to fire. The user can enter text directly into the combo field or click the list icon to display a list of available values. 'SALARY'). Combines the features found in list and text items. Usage Notes • SYSTEM. label. 13.TRIGGER_NODE is the node the user clicked on. Appears as a rectangular box which displays a fixed number of values. label. ELSIF tp_lb LIKE 'Va%' THEN SET_TAB_PAGE_PROPERTY(tp_id. Only enduser action will generate an event. the combo box style list item will display fixed values and accept one operator-entered value. Usage Notes • • SYSTEM. • Defining list items A list item displays a predefined set of choices that LIST ITEM Poplist Text List are mutually exclusive can be displayed as either a poplist. SYSTEM.Shik Mahamood Ali 87 IF tp_lb LIKE 'Sa%' THEN SET_TAB_PAGE_PROPERTY(tp_id. When the operator selects the list icon. ELSE null. No programmatic action will cause the When-Tree-Node-Activated trigger to fire.TRIGGER_NODE returns a value of type NODE. SYSTEM. END IF. No programmatic action will cause the When-Tree-Node-Expanded trigger to fire.TRIGGER_NODE returns a value of type NODE. When the text list contains values that cannot be displayed (due to the displayable area of the item).
Shik Mahamood Ali 88 .
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.