Options

Taking the last change from trigger

Miklos_HollenderMiklos_Hollender Member Posts: 1,598
edited 2006-11-23 in NAV Tips & Tricks
Say you have function that scans Table A with a usual FINDSET - NEXT loop and does something with some f.e. adds it up and writes the sum somewhere else, or finds the last date, or something like that. If you want to automatically run it every time a record was inserted or updated in Table A, it does not work, because every trigger (OnValidate, OnModify) etc. runs BEFORE the changes were committed to the database, and COMMIT, SELECTLATESTVERSION etc. nothing helps. What you can do instead is to write a different function that takes the value change itself as a parameter and uses it, and call it as Rec.Field-xRec.Field as a parameter from these triggers.

Comments

  • Options
    Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Also, calling MODIFY from OnValidate and running the function also works.
Sign In or Register to comment.