Results 1 to 8 of 8

Thread: Triggering additional code when saving

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    262

    Triggering additional code when saving

    Hi Guys

    Our latest web app seems to be testing well.

    One question though - when we save a new record, we then sync the info to our existing VFP system by calling a webservice. That works well but requires the users to press a "Sync" button on the web interface which is a bit clunky.

    We would like to call that automatically when a new record is saved.

    Anyone have any ideas how to do that?

    Thanks in advance

    Simon

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,379
    Hi Simon,

    See Triggers at database or table level: updates, inserts, etc.

    Regards,

    Yvonne

  3. #3
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,379
    Or, from the client, the beforeupdate or afterupdate Section delegates

    Event Sequences: Updating a record (web/mobile).

    Regards,

    Yvonne

  4. #4
    Senior Member
    Join Date
    Jan 2014
    Posts
    262
    Thanks Yvonne - sounds like just what we were looking for.

    Will give it a try

    Cheers

    Simon

  5. #5
    Senior Member
    Join Date
    Jan 2014
    Posts
    262
    Hi Yvonne

    We have tried this but cannot make our tablename_onafterinsert fire.

    We have a prg file we want to fire / run (from server side) whenever a new record is added to a particular table in our web app.

    In the tablenme_onafterinsert we hve a simple DO xxx.prg.

    We can run the xxx.prg from the console fine but not from the table trigger

    Any thoughts?

    Thanks in advance

    Simon

  6. #6
    Senior Member
    Join Date
    Jan 2014
    Posts
    262
    Hi Yvonne

    Update

    We cannot get ONAFTERINSERT or ONAFTERUPDATE to work at all by using the GUI but we can set the constraints in code and they fire.

    Interestingly, constraints made in code do not show up in the table triggers GUI.

    However, what we are trying to do is fire our prg when the user presses the save / tick button on the user interface.

    ONAFTERINSERT is too early and ONAFTERUPDATE can be triggered by combo boxes with data mapping in place - again too early.

    How can we trigger code when the user saves the record? We don't mind if it is a new record or an existing record.


    Thanks

    Simon

  7. #7
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,379
    Hi Simon,

    Try the Database Events: https://www.lianja.com/doc/index.php/Database_Events. The table name is passed to the program.

    If you have an example of the combobox with datamapping causing an update trigger to run, please submit a ticket, as I am not seeing this.

    Regards,

    Yvonne

  8. #8
    Senior Member
    Join Date
    Jan 2014
    Posts
    262
    Hi Yvonne

    Ticket submitted.

    Thanks in advance

    Simon

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us