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

Similar Messages

  • 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...

  • I want to update line level record in form

    Hi
    I have two blocks 1st Header block and 2nd Line level block.
    When i update line level block then changed data should get updated in the respective table.
    So my question is on which trigger/event i should wirte code to so that it will work.
    Thanks in advance..
    Thanks & Regards,
    Manoj
    Edited by: ManojT on May 6, 2009 11:40 PM

    Hi,
    Oracle Apps standard Save icon will fire trigger KEY-COMMIT at form level.
    If current block has a KEY-COMMIT trigger at block level, forms will fire this one. In this case, an eventual KEY-COMMIT trigger at form level will be overridden/fire after/fire before then one at block level depending on property "execution hierarchy" of the block level KEY-COMMIT trigger. Same thing for an eventual KEY-COMMIT trigger at (current) item level.
    Hope can help
    Mariella

  • 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

  • Why Module level trigger contains "WHEN-CHECKBOX-CHANGED" trigger in Forms 6i?

    Hi,
    Why Module level trigger contains triggers like "WHEN-CHECKBOX-CHANGED", "WHEN-BUTTON-PRESSED" etc.? "WHEN-CHECKBOX-CHANGED" trigger is present in CheckBox & "WHEN-BUTTON-PRESSED" trigger in Button. Then why these triggers are also presnt in Module?
    Can anyone please clarify my doubt?

    There's a lot of triggers that are present at different "scopes". Like they exist at the item level, the block level,
    the module level...
    The idea is if you have an action that should only occur at that one single item it can do in the item trigger. If
    it's for all of them on the block, in the block level trigger. If for all of them ever, at the module level.
    For example suppose you wanted it to do a next_item after the trigger executed you can put that logic in the module
    level trigger. A key thing to notice here is the trigger hierarchy. That is essential to know about.
    Right click on one of these triggers in the object navigator. The execution hierarchy is override, before and after.
    since each of these levels of the same trigger has this execution hierarchy this is, well, potentially not easy to
    understand what is going to happen. I would typically have a per-item trigger be before and a higher level trigger
    be after.
    And this execution hierarchy thing is something I'd love to see enhanced in the gui. I wish it was a lot easier to see
    what the execution hierarchy is when editing a trigger text. I wish one could see and modify the execution hierarchy on the
    same screen as the trigger text and what would be really great is some way to tell how the trigger hierarchy will sort out
    at run time. For example if one is looking at an item level trigger it would be fabulous to know that as is, that trigger will be
    overridden by a higher level trigger and so on. Or vice versa if one is looking at a block level or form level trigger that it is
    overridden by a lower level trigger, or it will execute before or after some other trigger. I don't know what is defined to happen
    with various levels of triggers that have the same execution hierarchy. Like suppose they are all override,before,after.. then
    what happens? It'd be good to know.

  • 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);

  • 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;

  • How to block inventory at sales order level

    Hi to all,
                i am using sapb1 2005 pl36 i want to block invetory at sales order level means what i want, if any user create sales order of item1 if instock qty of that item1 is 10 and commited is 10 then availabale inventory is 0 nos .means sales order  should not posted it should be block at sales order level.so how it can possible .if it possible through addon pls send code of perticular.i will await for positive reply .
    Regards,
    Vishal

    Vishal,
    You can use Application_FormDataEvent to block the add.
      Private Sub Application_FormDataEvent(ByRef args As SAPbouiCOM.BusinessObjectInfo, ByRef bubbleEvent As Boolean) Handles MyApplication.FormDataEvent
        If args.BeforeAction Then
          Select Case args.EventType
            Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
              ' get document form
              Dim form = MyApplication.Forms.Item(args.FormUID)
              ' get docucment matrix
              Dim matrix = DirectCast(form.Items.Item("38"), SAPbouiCOM.Matrix)
              For row = 1 To matrix.RowCount
                ' get ItemCode
                Dim ItemCode = DirectCast(matrix.Columns.Item("1").Cells.Item(row).Specific, SAPbouiCOM.EditText).String
                ' Do a query on inventory or use Company object
                ' If a line is not allowed block adding the order:
                bubbleEvent = False ' order is now blocked!!
              Next row
          End Select
        End If
      End Sub

Maybe you are looking for

  • Changing Lion PDF default security settings

    After I create a document in Word or Pages, I save them as a pdf.  I then want to digitally sign them in Adobe Reader.  But the default security settting when saving as a pdf does not allow adding a digital signature.  Anyway to change the default OS

  • USB problem: any ideas?

    When I turn on my G5 and get to my log in screen, a dialogue box appears with the following: "USB OVER CURRENT NOTICE The USB device is currently drawing too much power. The port it is attached to will be deactivated." I don't actually have anything

  • SELECTION SCREEN - Intervals

    Hi, I have a selection screen field. I want to perform custom checks on that field. For example I have a field as below: Grade: _________    to ______ I enter F and A in the above fields for LOW and HIGH respectively. As per my application A is great

  • How is this Possible? Please SEE

    Hi Why is the output of this being shown as 0? Sudnt this be shown as 10? public class AQuestion          private int i = giveMeJ();          private int j = 10;          private int giveMeJ()               return j;          public static void main(

  • Message F5670

    Hi All I got the below error, plz suggest me how to resolve this issue No account is specified in item 0000000026 Message no. F5670 Diagnosis No account was specified for account type "S" in item "0000000026" of the FI/CO document. System Response Th