3 Replies Latest reply on May 10, 2016 10:50 AM by SteveMartino

    Script Help: Upon File Close

    rfpfhc

      I need help learning how to write a script to copy one field (that field is the time modification field) into a static field when the file is closed for all the files that were done on that specific day; (filemaker pro 13, mac os)

        • 1. Re: Script Help: Upon File Close
          SteveMartino

          I am having a hard time following your terminology.

           

          I need help learning how to write a script to copy one field (that field is the time modification field) into a static field when the file is closed for all the files that were done on that specific day; (filemaker pro 13, mac os)

           

          Are you saying ...for all the files that were done on that specific day...Do you mean all the records that were modified on that day, or do you have multiple database files open?

           

          When you say...copy one field (that field is the time modification field) into a static field...do you want to copy the timestamp field from any record that was modified, and replace all the records that were modified with that value?

           

          What purpose does saving a one value timestamp serve the next time you open the database?  Are you trying to save a found set of recently modified records?

           

          If you are trying to track changes in a log, a better option would be to add a log to your database, either one you build yourself or a 3rd party plug-in.

           

          If you want to see what records were modified in the last session, you could easily do a find on the timestamp field and get a found set of records that were modified, assuming that opening your database and looking at records doesn't trigger anything that would update the timestamp.

          • 2. Re: Script Help: Upon File Close
            rfpfhc

            My apologies, you are correct in improving my terminology;let me rephrase the question:I need help learning how to write a script to copy one field {{it is the field that is automatically set up to put in the time that the record was last touched - time modification field}} into another field that will not change with the record is touched again.I would like this to occur for all the records that were created on that day; in actuality I am not sure if filemaker server closes the file when it runs day end backup; I was thinking that I could use that as a trigger "uponfileclosure" to have the script run. (filemaker pro 13, mac os)Perhaps you are correct that a logging function is better; but alas I do not know how to do that either; can you point me in the right direction; The idea is to capture the time's that the record is last touched; some times, an incidental click into the record will change the modification time even though nothing was changed in the record. I am not so much looking for a search but want to capture the time the record was touched for certain day; if we click in that record on the next day whether it be incidental or not, the modified time and date field will be changed;thanks so much

            • 3. Re: Script Help: Upon File Close
              SteveMartino

              I'm still confused about your workflow, so I'll ask some more questions.

              So you close your file, and you want a script to run to put the modified timestamp into a field.

              --How will the script know which records to put this timestamp into?  For example:

              I modify records 1,2,3,4 and the modification field changes, as it should.  Then I look at record 5 do something that causes a modification change-click into a field, change a number, change it back, whatever, and the modification field changes.  Now, how would the script know to just change the new timestamp (modification field) upon the file closing to just records 1,2,3,4 and not 5?  I don't think that is possible.

              You also state you want to do this for records 'created on that day', which is a lot easier if you have a timestamp field for 'on creation'.

              That's why I recommend auditing/logging trail.  You can pull up an easy picture of what, when, where, how.  You'll easily see which records to ignore and which ones were actually modified

               

              Take a look at some of the auditing and logging stuff.  Type in google FileMaker audit trail and get all the forums, blogs, and even youtube videos.  Here's 3 for starters

              FMEasyAudit | An Open Source Auditing Solution for the FileMaker Platform

              https://www.excelisys.com/fm-tips/filemaker-pro-13-tip-n-trick-easy-bake-filemaker-pro-13-audit-trail/

              Leverage FileMaker Audit Logs: add a Wayback Machine for your Data

              NightWing Enterprises - Products for FileMaker Pro Developers