6 Replies Latest reply on Aug 29, 2014 3:32 PM by MichaelAnderson_1

    Record changes to fields

    MichaelAnderson_1

      Title

      Record changes to fields

      Post

           Is there a way in filemaker to record what changes have been made to a table?

            

           We are giving customers a form with their demographics as read only, with a button to change, and when they change their name or something else. Is it possible to write what they changed to a separate table?

        • 1. Re: Record changes to fields
          philmodjunk

               It's possible. It's just not a built in feature of the product. You'd need to use one of the third party supplied tools for this or create you own set up with buttons, scripts, script triggers etc to log those changes.

               One method is to use OnObjectEnter to perform a script that captures the current field's value in a global variable and OnObjectSave to compare the value of the variable to the current field value and save the previous value if the values are different. Some systems make an entry in a table field by field, others build up a list in one or more variables and log the data all in one batch when the record is committed.

               If you have a portal to a related table, the process becomes even more complex.

          • 2. Re: Record changes to fields
            MichaelAnderson_1

                 hmm. I see what you are saying  (somewhat). Let me ask you this.

                  

                 If I have five fields. Would I need to make  five different scripts for each field. 

                 Like Set Variable [[$$First_Value; Value:dbo.patient_info::First_Name]

                 or is there a way to reference the name of the field that triggered the event?

            • 3. Re: Record changes to fields
              philmodjunk

                   You won't need a different script for each field. There are get functions such as Get ( activeFieldContents) and Get ( ActiveFieldName) that can identify the field with the focus and you can use script parameters to pass the initial value of a field to the script as a script parameter.

              • 4. Re: Record changes to fields
                MichaelAnderson_1

                     I hate to see asking questions, but I am still having some trouble.


                     I setup a script: that triggered OnObjectEnter

                     Set Variable [[$$First_Value; Value:Get (ActiveFieldContents)]

                     Show Custom Dialog [$$First_Value]

                     Set Field [dbo.Change_Audit::Oldvalue;$$First_Value]

                     Set Field By Name [dbo.Change_audit::Old_value; $$First_value]

                      

                     I made a table in SQL called Change_Audit (my main table is calld Customer_info)

                      

                     I added the new table into filemaker, and made a relationship between them based on Customer ID

                     I added the field ::old value but when the script triggers i get the message box, but nothing changes in the field old value, or the database that is connected to that.

                      

                     What am I doing wrong?

                • 5. Re: Record changes to fields
                  philmodjunk

                       This step does not make sense:

                       

                            Set Field By Name [dbo.Change_audit::Old_value; $$First_value]

                       say the value returned by "get ( ActiveFieldContents)" is the number 25.

                       The above script step woudl then try to set a field named "25" to the value of 25.

                       is dbo.Change_audit, the table occurrence name on which your current layout is based?

                       If this is the name of a different table than the table in which a record is being modified, you need to change to a layout based on dbo.Change_audit before trying to set data to fields in that table. (and you may need to create a new record linked to the primary key of your edited record in the original layout before setting any fields to values...)

                  • 6. Re: Record changes to fields
                    MichaelAnderson_1

                         Phil,

                         I was unsure what the difference between set field by name, and set field so I was trying both of them.

                          

                         I will try out your answers. Thanks!