FORM就是由一系列的触发器组成的。下面是对FORM中TRIGGER的执行顺序的总结。其中还有很多触发器没有被提到,这是因为程序中没有用到。但是在FORM运行的过程中,这些触发器的执行过程都是设置好了的,没有用到的触发器也一样会经过已经设置好的那个时间段,只是什么动作都没有做罢了。

下面,是常用的的触发器的执行顺序:


触发器执行顺序:

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-INSTANCE

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