CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle Forms
Version 10.2
 
10g Configuration
Configuration Files c:\oracle\product\orads orms90\server orms90.conf
c:\oracle\product\orads orms90\server ormsweb.cfg
c:\oracle\product\orads orms90\server\default.env
 
Query Where
&  
:x  
 
File Types
.fmb Form binary source code
.fmt Form text
.fmx Form executable
.mmb Menu source code
.mmt Menu text
.mmx Menu executable
.pll Menu binary source code
.pld  
.plx Menu executable
.mmx  
.mmx  
.mmx  
 
Window Types
   
   
 
Canvas Types
Content  
Stacked  
Tabbed  
Horizontal Toolbar  
Vertical Toolbar  
 
Block Types
Single-record  
Multi-record  
 
Commit
COMMIT_FORM Writes all changed records in all blocks to the database ... performs a commit
FORMS_DDL('COMMIT') Commit in the database independent of the form
 
GET_APLICATION_PROPERTY built-in
APPLICATION_INSTANCE
Returns the pointer value of an instance handle (Windows only)
BEGIN
  :control.fld := get_application_property(APPLICATION_INSTANCE);
END;
BUILTIN_DATE_FORMAT
Returns the current value of the Builtin date format mask held in the Builtin_Date_Format property
BEGIN
  :control.fld := get_application_property(BUILTIN_DATE_FORMAT);
END;
CALLING_FORM
Returns the name of the calling form if the current form was started with CALL_FORM
BEGIN
  :control.fld := get_application_property(CALLING_FORM);
END;
CONNECT_STRING
Returns the database connect string entered when logging on
BEGIN
  :control.fld := get_application_property(CONNECT_STRING);
END;
CURRENT_FORM
Returns the .FMX file name of the current form including the full path
BEGIN
  :control.fld := get_application_property(CURRENT_FORM);
END;
CURRENT_FORM_NAME
Returns the name from the Name property of the current form
BEGIN
  :control.fld := get_application_property(CURRENT_FORM_NAME);
END;
CURSOR_STYLE
Returns the style property of the current form. Options are BUSY, CROSSHAIR, DEFAULT, HELP, and INSERTION.
BEGIN
  :control.fld := get_application_property(CURSOR_STYLE);
END;
DATASOURCE
Returns the name of the database currently in use. Options are NULL, ORACLE, DB2, NONSTOP,
TERADATA, NCR/3600/NCR/3700, and SQLSERVER
BEGIN
  :control.fld := get_application_property(DATA_SOURCE);
END;
DATE_FORMAT_COMPATIBILITY_MODE
Returns the compatibility setting contained in this property
BEGIN
  :control.fld := get_application_property(DATE_FORMAT_COMPATIBILITY_MODE);
END;
DISPLAY_HEIGHT
Returns the height of the display in the coordinate system of the form module
BEGIN
  :control.fld := get_application_property(DISPLAY_HEIGHT);
END;
DISPLAY_WIDTH
Returns the width of the display in the coordinate system of the form module
BEGIN
  :control.fld := get_application_property(DISPLAY_WIDTH);
END;
ERROR_DATE / DATETIME_FORMAT
Returns the current value of the error date or datetime format mask.
 
FLAG_USER_VALUE_TOO_LONG
Returns the current value of the property ... either True or False ... which controls truncation of user
entered values
BEGIN
  :control.fld := get_application_property(FLAG_USER_VALUE_TOO_LONG);
END;
OPERATING_SYSTEM
Returns the name of the operating system currently in use
BEGIN
  :control.fld := get_application_property(OPERATING_SYSTEM);
END;
OUTPUT_DATE / DATETIME_FORMAT
Returns the current value of the output date or datetime format mask
 
PASSWORD
Returns the password of the current operator
BEGIN
  :control.fld := get_application_property(PASSWORD);
END;
PLSQL_DATE_FORMAT
Returns the current value of the PLSQL date format mask
BEGIN
  :control.fld := get_application_property(PLSQL_DATE_FORMAT);
END;
RUNTIME_COMPATIBILITY_MODE
Returns the compatiblity setting contained in this property
BEGIN
  :control.fld := get_application_property(RUNTIME_COMPATIBILITY_MODE);
END;
SAVEPOINT_NAME
Returns the name of the last savepoint issued by the form
BEGIN
  :control.fld := get_application_property(SAVEPOINT_NAME);
END;
TIMER_NAME
Returns the name of the most recently expired timer
BEGIN
  :control.fld := get_application_property(TIMER_NAME);
END;
USER_DATE / DATETIME_FORMAT
Returns the current value of the user date or datetime format mask
 
USER_INTERFACE
Returns the name of the user interface currently in use
BEGIN
  :control.fld := get_application_property(USER_INTERFACE);
END;
USER_NLS_CHARACTER_SET
Returns the current value of the character set portion only of the USER_NLS_LANG
BEGIN
  :control.fld := get_application_property(USER_NLS_CHARACTER_SET);
END;
USER_NLS_LANG
Returns the complete current value of the USER_NLS_LANG environment variable
BEGIN
  :control.fld := get_application_property(USER_NLS_LANG);
END;
USER_NLS_LANGUAGE
Returns the current value of the language portion only o fhte USER_NLS_LANG environment variable
BEGIN
  :control.fld := get_application_property(USER_NLS_LANGUAGE);
END;
USER_NLS_TERRITORY
Returns the current value of the territory portion only of the USER_NLS_LANG environment variable
BEGIN
  :control.fld := get_application_property(USER_NLS_TERRITORY);
END;
USERNAME
Returns the name of the form's current operator. If the form was connected with an externally authenticated user account use GET_APPLICATION_PROPERTY(CONNECT_STRING) instead
BEGIN
  :control.fld := get_application_property(USERNAME);
END;
 
SYSTEM Variables
:SYSTEM.BLOCK_STATUS
BEGIN
  :control.fld := :SYSTEM.BLOCK_STATUS;
END;
:SYSTEM.COORDINATION_OPERATION
 
:SYSTEM.CURRENT_BLOCK
 
:SYSTEM.CURRENT_DATETIME
 
:SYSTEM.CURRENT_FORM
 
:SYSTEM.CURRENT_ITEM
 
:SYSTEM.CURRENT_VALUE
 
:SYSTEM.CURSOR_BLOCK
 
:SYSTEM.CURSOR_ITEM
 
:SYSTEM.CURSOR_RECORD
 
:SYSTEM.CURSOR_VALUE
 
:SYSTEM.CUSTOM_ITEM_EVENT
 
:SYSTEM.CUSTOM_ITEM_EVENT_PARAMETERS
 
:SYSTEM.DATE_THRESHOLD
Settable
 
:SYSTEM.EFFECTIVE_DATE
Settable
 
:SYSTEM.FORM_STATUS
 
:SYSTEM.LAST_QUERY
 
:SYSTEM.LAST_RECORD
 
:SYSTEM.MASTER_BLOCK
 
:SYSTEM.MESSAGE_LEVEL
Settable. Controls the error level that causes error events in the form. A level of 10 means break for every error while a level of 5 means only break on serious errors.
In the WHEN-NEW-FORM trigger at module level

BEGIN
  :system.message_level := 5;
END;


Then test in the form by creating a control block with a text item named fld. Then create a button and put the following code on the button:

BEGIN
  :control.fld := :SYSTEM.BLOCK_STATUS;
END;
:SYSTEM.MODE
 
:SYSTEM.MOUSE_BUTTON_PRESSED
 
:SYSTEM.MOUSE_BUTTON_SHIFT_STATE
 
:SYSTEM.MOUSE_ITEM
 
:SYSTEM.MOUSE_CANVAS
 
:SYSTEM.MOUSE_X_POS
 
:SYSTEM.MOUSE_Y_POS
 
:SYSTEM.MOUSE_RECORD
 
:SYSTEM.MOUSE_RECORD_OFFSET
 
:SYSTEM.RECORD_STATUS
 
:SYSTEM.SUPPRESS_WORKING
Settable
 
:SYSTEM.TAB_NEW_PAGE
 
:SYSTEM.TAB_PREVIOUS_PAGE
 
:SYSTEM.TRIGGER_BLOCK
 
:SYSTEM.TRIGGER_ITEM
 
:SYSTEM.TRIGGER_RECORD
 
:SYSTEM.
 
:SYSTEM.
 
Block Error Handler
DECLARE
 FormErr   NUMBER;
 dbErrNo   NUMBER;
 dbErrTxt  VARCHAR2(200);
 FormTxt   VARCHAR2(80);
 ErrTyp    VARCHAR2(3) ;

BEGIN
  -- your code here
EXCEPTION
  WHEN OTHERS THEN
    FormErr := ERROR_CODE;

    IF FormErr = 40508 THEN
      -- get the database error and text
      dbErrNo := DBMS_ERROR_CODE;
      dbErrTxt := DBMS_ERROR_TEXT;

      -- display the real problem
      MESSAGE('ORA'||TO_CHAR(dbErrNo)||': '||dbErrTxt, ACKNOWLEDGE);
    ELSE
      -- get the form messages
      FormTxt := ERROR_TEXT;
      ErrTyp := ERROR_TYPE;

      -- show the complete form message and error
      MESSAGE(ErrTyp || '-' || TO_CHAR(FormErr) || ': ' || FormTxt);
    END IF;
    RAISE FORM_TRIGGER_FAILURE;
END;
ON-ERROR Trigger
DECLARE
 ErrCode NUMBER := error_code;
 ErrType VARCHAR2(3) := error_type;
 ErrText VARCHAR2(200) := error_text;

 dbmserrtext VARCHAR2(200);
 dbmserrcode NUMBER;

BEGIN
  dbmserrcode := DBMS_ERROR_CODE;
  dbmserrtext := DBMS_ERROR_TEXT; 

  IF error_code IN (40501, 40502, 40504, 40505, 40506, 40507, 40508, 40509, 40510, 40511, 40512, 40513) THEN
    INSERT INTO error_log
    (proc_name, block_identifier, error_code, error_message, system_mode)
    VALUES
    (:global.form_name, ErrType, TO_CHAR(ErrCode), ErrText, :SYSTEM.MODE);

    MESSAGE('IF: ' || dbms_error_text);
  ELSE
    INSERT INTO error_log
    (proc_name, block_identifier, error_code, error_message, system_mode)
    VALUES
    (:global.form_name, ErrType, TO_CHAR(ErrCode), ErrText, :SYSTEM.MODE);

    MESSAGE('ELSE: ' || ErrType || '-' || TO_CHAR(ErrCode) ||': '|| ErrText);
    -- show_al_msg_stop(Err_Type || '-' || TO_CHAR(Err_Code) ||': '|| Err_Text);
    -- show_al_msg_stop(dbms_error_text);
  END IF;
END;
Exit Button
-- exit the form without validation and without forcing the user to save unsaved changes
BEGIN
  IF :SYSTEM.MODE = 'ENTER-QUERY' THEN
    EXIT_FORM(NO_VALIDATE);
    EXIT_FORM(NO_VALIDATE);
  ELSE
    EXIT_FORM(NO_VALIDATE);
  END IF;
END;
Editor Trigger
-- For an editor named TCOM_ED this code will pop it up with a WHEN-MOUSE-DOUBLECLICK trigger
DECLARE
 val T.COMMENTS%TYPE;                -- size the variable vased on the table's comments field
 ed_ok BOOLEAN;                      -- capture the editor window output
BEGIN
  val := :T.COMMENTS;                             -- get the current value of the field
  SHOW_EDITOR('TCOM_ED', val, 10,14, val, ed_ok); -- pop up the editor and assign the
                                                  -- existing value
  IF ed_ok THEN                                   -- if the user presses Ok
    :T.COMMENTS := val;                           -- update the item from the editor
  END IF;
END;
 
Related Topics
JDeveloper
Reports
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [274 users online]    © 2010 psoug.org