Search code examples
foxpro

Create FoxPro Trigger


I want to create a trigger in foxpro that will execute after every update in my db table, for example JobActivity.After every update, the trigger should insert the update time in the table JobActivity.


Solution

  • Instead of AFTER the update, you could apply a Record RULE validation (as @Stuart Dunkeld mentions) that is applied against the entire record before the insert/update is processed.

    Go to your database container and create a stored procedure something like

    FUNCTION SP_LastUpdated()
       replace LastEditDT WITH DATETIME()
       RETURN .t.
    ENDFUNC
    

    Then, for the record validation rule, put in SP_LastUpdated().