5 Replies Latest reply: Nov 22, 2012 4:01 AM by François Degrelle RSS

    What triggers  fire on saving ?

    DurgaSrinivas_886836
      Hi All,

      please let me know ALL the triggers* which will fire when we press save in FORM.?


      Thanks,
      Durga Srinivas
        • 1. Re: What triggers  fire on saving ?
          rthampi
          If item level triggers (WHEN-VALIDATE-ITEM and POST) were validated, then block level triggers are fired. After that, form level triggers are fired. The number of triggers fired will depend upon how many triggers are using. A moderately decent explanation of COMMIT is available with 6i help section.

          regards,
          raj
          • 2. Re: What triggers  fire on saving ?
            DurgaSrinivas_886836
            Hi Raj,

            I have a non database block in form. so when i change a value, form is unable to identify these changes(message shows as "no changes to save"). so when i update the values of this block i want the updated values to be committed. Can u you suggest me how we can identify these changes and proceed to commit them .

            Thanks ,
            Durga Srinivas
            • 3. Re: What triggers  fire on saving ?
              rthampi
              DurgaSrinivas_886836 wrote:
              Hi Raj,

              I have a non database block in form. so when i change a value, form is unable to identify these changes(message shows as "no changes to save"). so when i update the values of this block i want the updated values to be committed. Can u you suggest me how we can identify these changes and proceed to commit them .

              Thanks ,
              Durga Srinivas
              As your block is not based on a table, what exactly you are trying to achieve by a commit? are you triggering a particular event and updating database tables with control block values? This could be done by writing appropriate codes with KEY-COMMIT trigger

              example code for KEY-COMMIT trigger
              if :controlblock.column = 'SOMETHING' then
              insert into my_table(col1,col2, col3)
              values('a',1000,'b');
              update my_table
              set col1=:controlblock.column;
              end if;
              COMMIT;
              You can write a code with ON-ERROR trigger to suppress 'Nothing to save' and override it with your own set of messages.

              --Sorry for the wrong trigger, I said 'ON-MESSAGE' instead of ON-ERROR earlier. Updated the post

              ON-ERROR trigger
              DECLARE alert_button NUMBER;
              lv_errtype VARCHAR2(3) := MESSAGE_TYPE;l
              v_errcod NUMBER := MESSAGE_CODE;
              lv_errtxt VARCHAR2(80) := MESSAGE_TEXT;
              BEGIN 
              IF lv_errcod = 40401 THEN 
              MESSAGE('Record Saved');
              END IF;
              END;
              The above is a specific method, as you already did a commit to the database by issuing the Commit

              I hope you get some idea from the post :)

              regards,

              raj

              Edited by: rthampi on Nov 22, 2012 12:33 AM
              • 4. Re: What triggers  fire on saving ?
                O.Developer
                In Forms Terminology,, Pressing SAVE button means.. as you know...



                Completing all pending insert/update.



                So wherever /whichever level your form made transaction, all will be effected.





                Instead, you can ask specific question about your requirement to get more ideas from forum



                Hope you understood the logic behind forms
                • 5. Re: What triggers  fire on saving ?
                  François Degrelle
                  Hello,

                  Here is what is fired (in order) at commit time. This supppose you have one record to update and one record to insert:

                  POST-TEXT-ITEM
                  POST-RECORD
                  POST-BLOCK
                  PRE-COMMIT
                  PRE-UPDATE
                  ON-UPDATE
                  POST-UPDATE
                  PRE-UPDATE
                  PRE-INSERT
                  ON-INSERT
                  POST-INSERT
                  POST-FORM-COMMIT
                  ON-COMMIT
                  POST-DATABASE-COMMIT
                  PRE-BLOCK
                  PRE-RECORD
                  PRE-TEXT-ITEM
                  WHEN-NEW-ITEM-INSTANCE

                  Francois