I'm trying to create the following scenario in Filemaker:
I basically would like to track changes of a value in a table, when used in a layout.
To make it simple, I have a table with two columns, Table 1 with an ID (Primary Key) in the first column and the second column with a value. When I update/add the value in Column 2 for an ID in Table 1, I would like to store the ID, the new value, and the current timestamp in Table 2.
I would like this for both changes and new records in Table 1.
In SQL this is simple, just to create a trigger to insert a new record in Table 2 on Update in Table 1.
But have not yet figured out how to do it in Filemaker. I know that I can use script triggers. My guess is to use the script trigger OnRecordCommit and New Record/Request, and in the script do something like:
OnRecordCommit in layout "table1"
- Go to layout "table2"
- New Record/Request
- Set Field Table2::LogID; Table1::ID
- Set Field Table2::LogValue; Table1::Value
- Set Field Table2::LogTimestamp; get(Current Timestamp)
When I tried the scenario above, infinite empty records are created in table1
Guidance is truly appriciated! Sincerely, Christoffer