Oracle Forms-DEFAULT_VALUE Built-in
DEFAULT_VALUE built-in in oracle forms is used for assign value to variable if value of variable is NULL.
IF :DBT_BRANCH.LOCATION IS NULL THEN
:DBT_BRANCH.LOCATION:='Pune';
END IF;
is equivalent to
default_value('Pune','DBT_BRANCH.LOCATION');
But DEFAULT_VALUE is noramally used to initialize global variable if they are not exist. If global variable are not exist in system then it will create new one or else assign value if its value is NULL.
IF :DBT_BRANCH.LOCATION IS NULL THEN
:DBT_BRANCH.LOCATION:='Pune';
END IF;
is equivalent to
default_value('Pune','DBT_BRANCH.LOCATION');
But DEFAULT_VALUE is noramally used to initialize global variable if they are not exist. If global variable are not exist in system then it will create new one or else assign value if its value is NULL.
:SYSTEM.TRIGGER_ITEM vs :SYSTEM.CURRENT_ITEM
Both :SYSTEM.TRIGGER_ITEM and :SYSTEM.CURRENT_ITEM hascharacter string values which is in form ofBLOCK_NAME.ITEMN_NAME. :SYSTEM.TRIGGER_ITEM represents the Item in the scope of firing trigger. When :SYSTEM.TRIGGER_ITEM is referenced in KEY-XXX triggers then only it returns the values same as :SYSTEM.CURSOR_ITEM. :SYSTEM.CURSOR_ITEM representscurrently focused item and may change in a trigger if navigation takes place. Value of KEY-DUPREC Trigger
Key-DupRec trigger is used to Copy previous record to current record in Create Record Mode. Whole record contains from last record including Sequence numbers are copied and newly record is not marked for validation. Item level validations are fired unless we go to item of newly created record and try to change it. If you are using PRE-INSERT trigger to generate Record last Change Details, auditing and Sequence number then duplicated records will have values calculated/generated in PRE-INSERT trigger.Its is always better idea to code constraints to database side. If you code constraints at database end then1) Constraint violating record never will be in database.
2) If your application have different middle tier and client tierimplemented in different technologies/channels then you can just catch these ora errors and make them user friendly before displaying.
:SYSTEM.TRIGGER_ITEM remains same frombegining of trigger till end.
Oracle form size-(Introduction of P-Code???)
Yesterday I was doing some maintenance on one form. So achieve desired functionality I modified it. I hardly added 4-6 procedures ofaverage 8-10 line of codes. Initially forms .fmb size was about 3.4MB. After modification it become around 8.5MB. I was wondering what has happened with form…
One of my Team member suggest me to replace ‘;’ with ‘;’ in all code which is very common solution is something is not working as expected. I did so. But Due to that is it broken inheritance “Trigger Text” of inherited trigger at Form, Block and item level. Property classes trigger’s inheritance was also broken. So I have to re-inherit all the triggers manually. Finally form size was reduced to 3.2MB. That guy told me that “P-code” has been inserted into form. Igoogled for p-code related to Oracle forms but unfortunately i didn’t get any information.
One of my Team member suggest me to replace ‘;’ with ‘;’ in all code which is very common solution is something is not working as expected. I did so. But Due to that is it broken inheritance “Trigger Text” of inherited trigger at Form, Block and item level. Property classes trigger’s inheritance was also broken. So I have to re-inherit all the triggers manually. Finally form size was reduced to 3.2MB. That guy told me that “P-code” has been inserted into form. Igoogled for p-code related to Oracle forms but unfortunately i didn’t get any information.
Do_key and Execute_trigger
EXECUTE_TRIGGER built-in Description - EXECUTE_TRIGGER executes an indicated trigger.
Syntax
PROCEDURE EXECUTE_TRIGGER(trigger_name VARCHAR2);
Built-in Type -
restricted procedure (if the user-defined trigger calls any restricted built-in subprograms)
Enter Query Mode – yes
Note:
EXECUTE_TRIGGER is not the preferred method for executing a user-named trigger: writing a user-named subprogram is the preferred method.
Parameters -
Trigger_name Specifies the name of a valid user-named trigger.
Usage Notes
Because you cannot specify scope for this built-in, Form Builder always looks for the trigger starting at the lowest level, then working up.
To execute a built-in associated with a key, use the DO_KEY built-in instead of EXECUTE_TRIGGER.
For example, rather than:
Execute_Trigger ('KEY-NEXT-ITEM');
Use instead:
Do_Key('NEXT_ITEM');
EXECUTE_TRIGGER restrictions
Although you can use EXECUTE_TRIGGER to execute a built-in trigger as well as a user-named trigger, this usage is not recommended, because the default fail behavior follows a different rule than when invoked automatically by Form Builder as part of default processing. For example, in default processing, if the When-Validate-Item trigger fails, it raises an exception and stops the processing of the form.
However, if the When-Validate-Item trigger fails when it is invoked by EXECUTE_TRIGGER, that failure does not stop the processing of the form, but only sets Form_Failure to FALSE on return from the EXECUTE_TRIGGER built-in.
Syntax
PROCEDURE EXECUTE_TRIGGER(trigger_name VARCHAR2);
Built-in Type -
restricted procedure (if the user-defined trigger calls any restricted built-in subprograms)
Enter Query Mode – yes
Note:
EXECUTE_TRIGGER is not the preferred method for executing a user-named trigger: writing a user-named subprogram is the preferred method.
Parameters -
Trigger_name Specifies the name of a valid user-named trigger.
Usage Notes
Because you cannot specify scope for this built-in, Form Builder always looks for the trigger starting at the lowest level, then working up.
To execute a built-in associated with a key, use the DO_KEY built-in instead of EXECUTE_TRIGGER.
For example, rather than:
Execute_Trigger ('KEY-NEXT-ITEM');
Use instead:
Do_Key('NEXT_ITEM');
EXECUTE_TRIGGER restrictions
Although you can use EXECUTE_TRIGGER to execute a built-in trigger as well as a user-named trigger, this usage is not recommended, because the default fail behavior follows a different rule than when invoked automatically by Form Builder as part of default processing. For example, in default processing, if the When-Validate-Item trigger fails, it raises an exception and stops the processing of the form.
However, if the When-Validate-Item trigger fails when it is invoked by EXECUTE_TRIGGER, that failure does not stop the processing of the form, but only sets Form_Failure to FALSE on return from the EXECUTE_TRIGGER built-in.
TUESDAY, FEBRUARY 24, 2009
LIST_VALUES
LIST_VALUES displays the list of values for the current item, as long as the input focus is in a text item that has an attached LOV. The list of values remains displayed until the operator dismisses the LOV or selects a value. By default, LIST_VALUES uses the NO_RESTRICT parameter. This parameter causes Oracle Forms not to use the automatic search and complete feature. If you use the RESTRICT parameter, Oracle Forms uses the automatic search and complete feature.
Automatic Search and Complete Feature:
With the automatic search and complete feature, an LOV evaluates a text item's current value as a search value. That is, if an operator presses [List] in a text item that has an LOV, Oracle Forms checks to see if the item contains a value. If the text item contains a value, Oracle Forms automatically uses that value as if the operator had entered the value into the LOV's search field and pressed [List] to narrow the list. If the item value would narrow the list to only one value, Oracle Forms does not display the LOV, but automatically reads the correct value into the field.
Usages of RESTRICT kwyword:
Where list value has too many valus then it affects the performance of the application. At that time use RESTRICT.
No comments:
Post a Comment