我總結了FORM的一些操作中TRIGGER的執行順序。其中還有很多觸發器沒有被提到,這是因為程式中沒有用到。但是在FORM運作的過程中,這些觸發器的執行過程都是設定好了的,沒有用到的觸發器也一樣會經過已經設定好的那個時間段,隻是什麼動作都沒有做罷了。其實這也是我做了一年客制化系統(Bond)中經常要打交道的東東。給大家分享一下。 下面,介紹一下我所總結出來的觸發器的執行順序: 觸發器執行順序: 1. 當打開FORM時: (1) PRE-FORM (2) PRE-BLOCK(BLOCK級) (3) WHEN-NEW-FORM-INSTANCE (4) WHEN-NEW-BLOCK-INSTANCE (5) WHEN-NEW-RECORD-INSTANCE (6) WHEN-NEW-ITEM-INSTANCE 2. 當填寫一行記錄完成後,光标移動到下一條記錄的時候: (1) WHEN-VALIDATE-RECORD (隻将填寫的記錄與資料庫中已存在的記錄作唯一性的驗證,如果隻是頁面上的資料重複而資料庫中沒有與其重複的值則不會報錯.) (2) WHEN-NEW-RECORD-INSTANCE (3) WHEN-NEW-ITEM-INSTANCE 3. 當點選“儲存”時 (1) WHEN-VALIDATE-RECORD (将頁面上的所有資料送出到資料庫,若頁面上有重複的資料,則送出第一次時成功但隻是将資料先寫到資料庫中一類似臨時表的地方,在送出第二條重複記錄的時候報錯,執行事務復原,原來執行成功的指令也将被撤消) (2) PRE-INSERT (3) ON-INSERT (4) POST-INSERT (5) POST-FORMS-COMMIT (6) PRE-BLOCK(BLOCK級) (7) KEY-COMMIT (8) WHEN-NEW-ITEM-INSTANCE 4. 當光标移動到目前資料塊中已經顯示的行上時: (1) WHEN-REMOVE-RECORD (2) WHEN-NEW-RECORD-INSTANCE (3) WHEN-NEW-ITEM-INSTANCE 當在該行上的不同ITEM移動時: (4)WHEN-NEW-ITEM-INSTANCE 5. 當要進行修改時(在記錄中的某個項上進行了修改時): (1)ON-LOCK 6. 在修改完成後進行儲存時: (1) WHEN-VALIDATE-RECORD (2) PRE-UPDATE (3) ON-UPDATE (4) POST-FORMS-COMMIT (5) PRE-BLOCK(BLOCK級) (6) KEY-COMMIT (7) WHEN-NEW-ITEM-INSTANCE 7. 删除一條記錄時: (1) ON-LOCK (2) WHEN-REMOVE-RECORD (3) KEY-DELREC (4) WHEN-NEW-RECORD-INSTANCE (5) WHEN-NEW-ITEM-INSTANCE 8. F11查詢過程: (1) WHEN-CLEAR-BLOCK (2) WHEN-NEW-RECORD-INSTANCE (3) WHEN-NEW-ITEM-INSTANCE 在輸入查詢條件後點CTRL+F11: (4) PRE-QUERY (5) WHEN-CLEAR-BLOCK (6) POST-QUERY (7) WHEN-NEW-RECORD-INSTANCE (8) WHEN-NEW-ITEM-INSTANCE 9.CRRL+F11: (1) WHEN-CLEAR-BLOCK (2) PRE-QUERY (3) WHEN-CLEAR-BLOCK (4) POST-QUERY(每查一條記錄,觸發一次) (5) WHEN-NEW-RECORD-INSTANCE (6) WHEN-NEW-ITEM-INSTANCE 10.從查詢狀态(F11)轉為輸入狀态(F4)時: (1) WHEN-CLEAR-BLOCK (2) KEY-EXIT (3) WHEN-NEW-RECORD-INSTANCE (4) WHEN-NEW-ITEM-INSTANCE 11.手電筒查詢過程: (1) QUERY_FIND(BLOCK級) 輸入查詢條件後,點選“查詢”按鈕: (2) WHEN-CLEAR-BLOCK (3) PRE-QUERY (4) WHEN-CLEAR-BLOCK (5) POST-QUERY (6) WHEN-NEW-RECORD-INSTANCE (7) WHEN-NEW-ITEM-INSTANC 12.點選“New”時: (1) WHEN-NEW-RECORD-INSTANCE (2) WHEN-NEW-ITEM-INSTANCE 13. 點選“Edit Field”時: (1)KEY-EDIT 14.點選“Window Help”時: (1)KEY-HELP 15.點選“Clear Record”時: (1) WHEN-REMOVE-RECORD (2) POST-QUERY (3) WHEN-NEW-RECORD-INSTANCE (4) WHEN-NEW-ITEM-INSTANCE 16.點選F4關閉時: (1) KEY-EXIT (2) POST-FORM 17.點選“Close Form”按鈕關閉時: (1) KEY-EXIT (2) POST-FORM 18.點選“Translations”按鈕時: (1)TRANSLATIONS 19.點選小叉号關閉時: (1) WHEN-WINDOW-CLOSED (2) CLOSE-WINDOW (3) KEY-EXIT (4) POST-FORM 20. 選中LOV清單: (1) KEY-LISTVAL (2) WHEN-NEW-ITEM-INSTANCE 21.選中記錄前面的小條時: (1) WHEN-NEW-RECORD-INSTANCE (2) WHEN-NEW-ITEM-INSTANCE(資料項級) (3) WHEN-NEW-ITEM-INSTANCE 22.光标上下移動時 (1) WHEN-NEW-RECORD-INSTANCE (2) WHEN-NEW-ITEM-INSTANCE |