Form level Trigger Vs Block Level trigger

I have a form with single Database Block. I need to write a
transaction Trigger for this Block. I need to know r there any
advantages of writing the triggers at Form Level rather than at
Block Level.
Thanx in advance
--- Moneesh Walia
null

Hello,
If you have to handle this stuff in more than one block, it seems more generic to put the code in a form-level trigger if you don't want to duplicate it several times.
Francois

Similar Messages

  • Block level trigger vs form level trigger

    Hello.
    I want to know what is better - to use block or form trigger?
    I have many blocks in my form. I need to write custom code in (for example) key-crerec trigger.
    Should i put trigger into each block or should i create one at form level like:
    if :system.current_block = 'BLOCK1' then
    create_record;
    elsif...
    end if;
    Thanks.
    Message was edited by:
    DejanH

    Hello,
    If you have to handle this stuff in more than one block, it seems more generic to put the code in a form-level trigger if you don't want to duplicate it several times.
    Francois

  • Force Form to Execute builtin trigger at form level

    Hi,
    I have form 10g R2 I put PRE-UPDATE trigger at block level and Form level but I when I update a record it executes only block level update trigger, I want to execute both builtin at block as well as form level, is there a way.
    Thanks and Regards, Khawar.
    Message was edited by:
    S. Khawar

    I created a test form (Oracle Forms 10g r1) that hits the EMP table in the SCOTT schema. In the form, I added a Pre-Update trigger at the Form and Block level. With the "Execution Hierarchy" (EH) left at the default Override, saving my form caused only the Block Pre-Update trigger to fire. Changing the Block EH to Before and the Form EH to After caused the Block Pre-Update to fire first followed by the Form Pre-Update. I then changed the Form EH to Before and the Block EH to After and tried it again. This time, the Save caused the Form Pre-Update to fire first and the Block Pre-Update to fire second. Therefore, S.Khawar, depending on which Pre-Update trigger you want to fire first, I suggest you set the Execution Hierarchy accordingly.
    That was an fun little exercise. I've had this discussion with people before, but never took the time to throw together a test case to confirm what really happens in a Form. Steve - thanks for raising the question! :-)
    Craig...

  • Form level v/s item level trigger in oracle forms

    Hello Experts,
                  I am new in oracle forms.I am using forms 11g with weblogic server 10.3.5 at windows 7.I am very confused between Form level and item level triggers.What is the sense of use of when-button-pressed trigger at item level & form level.If I have this trigger form level then how could I check that is fired.
    Thank  You
    regards
    aaditya

    979801 wrote:
    Hello Experts,
                  I am new in oracle forms.I am using forms 11g with weblogic server 10.3.5 at windows 7.I am very confused between Form level and item level triggers.What is the sense of use of when-button-pressed trigger at item level & form level.If I have this trigger form level then how could I check that is fired.
    Thank  You
    regards
    aaditya
    You need to clear you concept first..
    Form level Trigger: code applied all respective item within the form
    Item level Trigger: code applies for only the item that has the code.
    try in a form and you will see the difference.
    Hamid

  • Form level trigger

    Hi all,
    I need trigger function, their execution preference at form level. and when we execute query and go to next record
    which trigger fires at this stage at form level.
    Regards
    Rizwan Ali

    If you are running your form from the Forms Builder, try turning the Debug Messages on. This will show an alert for each trigger that fires. This will let you see what triggers fire throughout your form. This is very helpful in learning the firing sequence of triggers in forms.
    To turn this feature on go to the Edit Menu -> Preferences -> Runtime tab -> Debug Messages checkbox. While this is a handy feature - just don't forget to turn it off when you are finished as it can be quite annoying when you don't want it turned on. ;)
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Form level trigger size limit

    hi all,
    i am using Forms 6i.
    in a form level trigger, there is a code of around 2600 lines.
    while compiling the form it is showing an error 'Program too large'.
    is there any limitation on size?
    please suggest something.
    Regards
    PantherHawk

    Hi,
    I think you are getting PLS error from the database.
    Yes there are limitations.
    Refer :
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/limits.htm
    ORA-06540 ORA-06553 PLS-00123
    and
    Check Note: 62603.1.
    Nilaksha.

  • When-validate-item at form level do not fire

    Hi, I wrote a when-validate-item at form level to do same check in all items of a screen and note that this trigger do not fire when executing the form. does someone know why this form-level when-validate item do not fire. Are there some conditions i probably forgot to have? Thnaks very much.

    Hi, if you also have a validate-item trigger on the item itself, this may be overriding the form-level validate item.
    At the ITEM-LEVEL:
    if a when-validate-item trigger exists and the Execution Hierarchy property of the trigger is set to override then the item-level trigger will fire instead of any trigger by the same name at any higher scope.
    So make sure you do not have validate-item triggers at the item or block level that may be overriding the form-level when-validate-item.
    To see the properties of a trigger, highlight the trigger and press F4
    Hope this helps!

  • Form Level Variable

    I want to declare a form level variable and want to assign a value at WHEN-NEW-FORM-INSTANCE trigger and i want to use the same value in Program units as well as other form level and block level triggers. How to achieve this? Do i need to refer the variable with :Symbol? Thanks!

    Chris,
    There are a couple of ways to do this. As Ammad suggested, you can use a Global variable, but as you point out - Globals are visible to your Forms session unless you destroy the global. You can also use a Parameter as you have done or you can use a Control Block with a block item that will accept the type of data that will be stored in the variable. There are limitations with each of these options however.
    With Globals, all variables are of CHAR datatype and are limited to 4000 bytes in Forms 10g and higher and 255 in Form 9i and lower. Any non-character value stored in a global must be converted back to it's native datatype when you read the value to ensure it is evaluated correctly. When globals are declared, they always reserve the max amount of memory needed to support the 255 or 4000 characters. If you use Globals, it is a good habit to use the Erase() built-in to destroy the Global when you are finished with it. Also with Globals it is possible to get a Runtime error if the Global has not been initialized before you reference it, but will NOT produce a compile time error.
    Parameters and Control Block items are a little more flexible in that you can define the parameter's datatype as CHAR, DATE or NUMBER (check Forms Help for the max datatype values they can store). Parameters and Control block items also have properties which means they take up more memory resources because the properties of these items have to be loaded into memory in addition to the data.
    I would recommend using Parameters over Globals for Forms specific variables because you have greater flexibility with the data types supported, however, I personally prefer to use a Forms Package Specification with Package Variables declared as this more flexible and only allocates the amount of memory needed to support the variable. When I have a situation that requires a variable be visible to the entire form, but doesn't need to be Global to the session, I will create a Package Spec called FORM_VARS in the Program Units node of the Object Navigator and declare the variables I need. I do not create a Package Body. For example:
    PACKAGE FORM_VARS IS
       n_User_ID      NUMBER;
       v_User_Name  VARCHAR2(25);
    END;You then reference the variables the same as you would for any Forms program unit.
    BEGIN
       Forms_Vars.n_User_ID := 1234546;
       Forms_Vars.v_User_Name := 'John Doe';
    END;Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.
    Edited by: CraigB on Jun 28, 2010 11:17 AM

  • WebUtil doesn't work when called from WHEN-NEW-FORM-INSTANCE trigger

    I need WEBUTIL_CLIENTINFO functions to know some information from the client, like IP, JavaVersion, Hostname, OS user, etc. This functions I call through WHEN-NEW-FORM-INSTANCE TRIGGER and this doesn't nor work. I obtain the next message and error:
    oracle/forms/webutil/clientinfo/GetClientInfo.class not found. WEBUTIL_CLIENTINFO.GET_IP_ADDRESS.
    But when I call this WebUtil functions through WHEN-WINDOW-ACTIVATED trigger or through a button it works. Why?. I need call WebUtils in the WHEN-NEW-FORM-INSTANCE trigger!
    Any help will be of great value.

    Basically make a timer...
    Do you have the wu_test_106.fmb file that comes with the webutil install?
    If you look in the wnfi trigger you will see this...
    declare
         fake_timer TIMER;
    begin
         -- Purpose of the fake timer is the we cannot call webutil in this trigger since the
         -- beans have not yet been instantiated.  If we put the code in a when-timer-expired-trigger
         -- it means that this timer will not start running until Forms has focus (and so the webutil
         -- beans will be instantiated and so call canbe made.
         fake_timer:= CREATE_TIMER('webutil',100,NO_REPEAT);
         --create_blob_table;
         null;
    end;And in the form level when-timer-expired you will see this...
         :global.user_home := webutil_clientinfo.get_system_property('user.home');
         :OLE.FILENAME := :global.user_home||'\temp.doc';
         SET_ITEM_PROPERTY('builtins.text_io_item',PROMPT_TEXT,'Write to '||:global.user_home||'\helloworld.txt');
         SET_ITEM_PROPERTY('files.userdothome',PROMPT_TEXT,:global.user_home);

  • How to raise an error message when duplicate value is entered in a tabular field column? Basically not allow duplicate value at the form level.

    Hi all,
    I have created a form with one data block MATURED_FD_DTL which looks like below:
    ACCT_FD_NO
    CUST_CODE
    FD_AMT
    FD_INT_BAL
    TDS
    CHQ_NO
    ADD_FD_AMT
    P_SAP_CODE
    P_TYPE
    CREATE TABLE MATURED_FD_DTL
      ACCT_FD_NO    VARCHAR2(17 BYTE)               NOT NULL,
      CUST_CODE     NUMBER(9),
      FD_AMT        NUMBER(15),
      FD_INT_BAL    NUMBER(15),
      TDS           NUMBER(15),
      CHQ_NO        NUMBER(10),
      ADD_FD_AMT    NUMBER(15),
      P_SAP_CODE    NUMBER(10),
      P_TYPE        VARCHAR2(1 BYTE)
    For MATURED_FD_DT.ACCT_FD_NO, Trigger: KEY_NEXT_ITEM, I have written the following code:
    DECLARE
    V1 NUMBER;
    V2 NUMBER;
    BEGIN
    V1:=:MATURED_FD_DTL.ACCT_FD_NO;
    MESSAGE('V1:'||V1);
    MESSAGE(' ');
    END;
         GO_ITEM('MATURED_FD_DTL.CUST_CODE');
    This is just a dummy code.
    When ever i enter the value in the field of ACCT_FD_NO, it pops up a message saying "V1:Value of ACCT_FD_NO",
    So i want to store that value .
    Compare them & if it is egual, it should pop up a message saying duplicate value is entered and must not allow to enter, at form_level.
    So how can I compare the ACCT_FD_NO value between FIRST_RECORD and NEXT_RECORD ??
    Help Me .
    Thank You.
    Oracle Forms 6i.
    Oracle 9i.

    Thank You HamidHelal.
    Actually before posting the code, I went through the first link you have mentioned. I tried also, it is quite tedious procedure, however i dint get the proper result, may be i have done some mistake. Anyways , can you tell me how do i check in database table, if a value exists OR IF VALUE FOUND & then message and raise form trigger failure; something like below.
    IF :MATURED_FD_DTL.ACCT_FD_NO EXISTS
    THEN MESSAGE('YOU HAVE ENTERED AN EXISTING OR DUPLICATE VALUE');
              MESSAGE(' ');
    RAISE FORM_TRIGGER_FAILURE;
    END;
    OR
    IF :MATURED_FD_DTL.ACCT_FD_NO FOUND
    THEN MESSAGE('YOU HAVE ENTERED AN EXISTING OR DUPLICATE VALUE');
              MESSAGE(' ');
    RAISE FORM_TRIGGER_FAILURE;
    END;
    Is there any equivalent in the form in oracle forms 6i?? Please let me know how do i do this??

  • Sorting at Form Level

    Dear All,
    thanx for my earliar queries, tahnx a lot.
    i am working on Forms 6i / Oracle 8i.Actaully, i need to sort some records on form level, which i got populated in the form one-by-one by the primary key.
    pls, suggest me how to proceed.
    Inderjeet Singh

    It's not Forms that does the sorting, but the database. That's why you modify the ORDER BY clause of the block; Forms passes it to the database which modifies the query accordingly.
    So one option is to base your block on a view, which can include your derived field. This is useful for sorting on things like foreign key lookups.
    If the thing you want to sort is not in the database, then you can implement your sort using PL/SQL and manipulating the blocks using the block and record built-ins.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Duplicate item checking failed in Form level-urgent

    Hi all
    i have creation page with advanced table
    i need to restrict the duplication at form level as well as save button
    in some cases the validation is failed
    if ("CodeValidation".equals(pageContext.getParameter(EVENT_PARAM)))
    itemcode = vo.getCurrentRow().getAttribute("ItemCode").toString();//advanced table multiple records come
    am.xxItemCodeValidation(itemcode);//checking the item validation at databse level
    am.xxdupitemcode(itemcode);
    method in am
    public void xxdupitemcode(String itemcode)
    System.out.println("The item code is.........."+itemcode);
    int count = 0;
    xxcrmNewItemVOImpl vo = getxxcrmNewItemVO1();
    vo.executeQuery();
    System.out.println("the row are" + vo.getAllRowsInRange().length);
    Row r[] = vo.getAllRowsInRange();
    int n = vo.getAllRowsInRange().length;
    for (int i = 0; i < n; i++)
    System.out.println("entered into this block......for loop" + count);
    if (itemcode.equals(r.getAttribute("ItemCode")))
    System.out.println("entered into this block......" + count);
    count = count + 1;
    System.out.println("the count is........."+count);
    if (count > 1)
    throw new OAException("Duplicate Item found plz change the item",
    OAException.ERROR);
    } else
    System.out.println("Exception block....... ");
    in save button i am calling
    if ("Save".equals(pageContext.getParameter(EVENT_PARAM)))
    am.xxdupitemcode(itemcode);
    am.invokeMethod("xxsavetr");
    in which case it is failing is
    in first row user enter
    ROW-ITEMCODE
    1-A
    2-A
    3-B
    4-B
    in second row and 4 th row exception is raised but user didnt change the itemcode and proceed for next steps
    IN SAVE BUTTON EXCEPTION IS RAISED
    but user will go to 4 th row and B should be change as C and click on save
    records are saving with duplication item of A
    but i need to restrict in save button also
    how its posible
    Regards
    Sreekanth

    Sreekanth,
    The correct way to check for duplicates is to check it both in the VO/EO cache as well as the database. It is possible the user entered duplicate value in the current session. In that case you should first check within the existing VO rows if the values are duplicated or not (in case all the database rows are already queried, you might not need to run an explicit query, otherwise another validation VO needs to be executed to check for duplicates).
    Regards
    Sumit

  • 40735 WHEN-NEW-FORM-INSTANCE-TRIGGER raised unhandled exception ORA-06502

    After migrationg my form from 6i to 10g I am getting the 40735 WHEN-NEW-FORM-INSTANCE-TRIGGER raised unhandled exception ORA-06502 err msg. the field is a date field and should be automatically populated with sysdate- 365. but when i open the form to run it is not populated automatically. i have to enter the date manually. the code in the NEW-FORM-INSTANCE trigger is as follows:
    declare
    record_id RecordGroup;
    error_cd number;
    begin
    -- Set the main window properties
    set_window_property(forms_mdi_window, window_state, maximize);
    -- Menu Security
    set_menu_items;
    select sysdate - 365
    into :start_date
    from dual;
    end;
    I check the property palate for the start_date field and it looks ok. the form is working fine in windows but the above message is comming out while running the form in Unix.
    Any help will be greatly apreciated.

    First thing, try qualifying the start_date with the block name
    declare
    record_id RecordGroup;
    error_cd number;
    begin
    -- Set the main window properties
    set_window_property(forms_mdi_window, window_state, maximize);
    -- Menu Security
    set_menu_items;
    select sysdate - 365
    into :block.start_date
    from dual;
    end;

  • When-new-form-Instance trigger raised unhandled exception ORA-04062

    Hi,
    We are facing ORA-04062 (FRM-40735 WHEN-NEW-FORM-INSTANCE trigger raised unhandled exception ORA 04062) while trying to run the first form of our Application.
    We are using a PL/SQL LIBRARY(.pll) for forms.
    We are using 10G Application Server,10G DB and Oracle 9i Forms.
    DB Version----10.1.0.4.0
    Application Server--9.0.4.0
    During compilation, we are following the below steps:
    1. Compile the .pll
    2.Compile Forms.
    When we are running these compiled version of forms and pll in Development server where we are compiling it,we are not facing any error.
    But when we are taking these compiled version of forms and pll to the Production Server,we are getting the above error.
    When we are compiling the .pll in Production server, Application runs fine.
    But we should not compile form or pll in Production server.
    Searching in Metalink(Note:73506.1) , we find a solution that remote_dependency_mode if set to signature this problem may be resolved.
    We tried that by chaning ' REMOTE_DEPENDENCIES_MODE=SIGNATURE' in Init.ora file in both Production and Development server.
    But the error still persist.
    I think the problem is regarding .pll.Because for the time being to test the application,I compiled the pll in Production and we didnot get any error while running the Application.
    But whenever we are tring to deploy the compiled version of pll (compiling in Development sever) and to run the application in Production, we are facing the error.
    Also, pll calls one standard database package in SYS.That standard package has VALID status both in Production and in Development.
    We donot have priviledge to change/compile that package.So,we didnot change anything in that package. We didnot change anything in .pll also.
    We are upgrading our forms from 6i to 9i.And now when we are trying to deploy it to Production we are facing ORA-04062 error.
    Can anyone please help ?

    Exactly what procedure or package in SYS are you calling that causes this problem?
    <p>Are both test and production databases at the same version?
    <p>Do you know what procedure or package is named in the error? If not, then you need to improve your on-error trigger processing. I use a PLL_On_Error trigger to capture and improve a number of Oracle messages. It is posted here:
    <p> Re: FRM-40735:Pre_Insert trigger raised unhandled exception ORA-20011
    <p>Note especially the part near the end that deals with FRM-40735. (Not sure, but you may also want to display DBMS_ERROR_TEXT in your situation.)
    <p>If that doesn't help find the actual problem, I would pull out my Re: Zdebug -- Download a Forms debugging message tool, and add messages before every call in the when-new-form-instance process to zero-in on the offending call.
    <p>If it really IS a call to a system process, I would then experiment with creating a server-side package or stored procedure that calls the process, and then call that stored procedure from my form. That way, you effectively insulate your form from system differences.

  • WHEN-NEW-FORM-INSTANCE trigger does not fire

    Hi,
    Does anyone have any idea why code placed in the when-new-form-instance trigger appears to be ignored when the form is executed from one login but runs fine when executed from another? A breakpoint on the first executable line of code in the trigger confirms that the trigger is not being fired.
    Regards,
    Ian Dodds.

    Hi again Duncan,
    I was able to solve it once I ran the form with the Forms Runtime Diagnostics enabled. I had a table in my schema containing old data used to build menu items. This was causing runtime errors to occur during calls to SET_MENU_ITEM_PROPERTY that were not being propagated to the UI so I didn't know they were occuring.
    The upshot was that the WHEN-NEW-FORM-INSTANCE trigger was not firing. Once I corrected the data it worked a treat.
    Thanks very much for pointing me towards FRD, it's the first time I've used it but it won't be the last.
    Cheers,
    Ian.

Maybe you are looking for

  • Convert a photo to a single line drawing

    It seems I've seen this in one of the photoshop tips & tricks books but did not buy the book. Any suggestions will be appreciated.

  • ST06 Screen values are not showing as ecpected

    Hi Experts, ST06 Screen values are not showing as expected like avg CPU idle time and min Swap space, page out and page in values etc. All fileds are showing "Zero Values" since last week and i just found tht today. I Went  to SM 36, All Configured s

  • System Reset

    Hi I am relatively new to mac, i recently updated final cut, pro applications, cinema tools etc, but when i restarted my computer everything had gone back to default settings i had to put serial numbers back into programs like cinema 4d and reset mot

  • Transport layer error when refreshing

    Hello! I don't know if this is the right place to ask my question, so forgive me, if not. I'm facing a weird problem within excel (2007 and 2013) when I'm trying to refresh or filter data retrieved from a cube (Microsoft Analysis Server 10.0.4000.0).

  • How to reformat OSX while ensuring my data is backed up (iTunes, music, pictures, etc)

    I have a Mid 2012 MBP running 10.8.5 and would like to reformat it. However, I would like to ensure that my iTunes library is backed up and remains in tact, as well as any other music, photos, etc... Also, I use Serato for DJing purposes - i would li