Announcement

Collapse
No announcement yet.

on change save all form values to a different (mutation) table

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • on change save all form values to a different (mutation) table

    When a new record is opened from another readonly form passing over the ID of a member I want to preload all the fields from a parent table. When a value is changed I want to save the old value in a old_value_column. So if the form is preloaded with the last name Steven from another table. When I change the name Steven in Stevens I want the form to save Steven in the colum old_name and Stevens in the column name. Can we do this with ScriptCase and how ?

  • #2
    You can. In the onload you need to store the old values into variables. In the onbeforeinsert you can fill the appropiate data. In general I have another approach. I create a history table with the same structure but datetime as key. Then I can use one simple sql statement to copy the old record into the history and then replace the original record.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      It did work indeed, exactly as you described. Thank you very much.
      Your approach is very straight forward indeed, but in this case I cannot use this approach. This database is transaction oriented and needs to see a changed value in the same table to trigger a transaction.

      Roelof

      Comment


      • #4
        Then dont use a history table, just use the second column. Or alternatively add a lastupdate column in which you store the date/time value of the last update.

        Comment

        Working...
        X