3 Replies Latest reply on Nov 10, 2011 10:42 AM by boydcrow

    Run script on every record to copy calculated field to new static field

    boydcrow

      Title

      Run script on every record to copy calculated field to new static field

      Post

      I want to use Set Field to copy the values in an existing calculated field to another field as permanent values.

      I only want to do this once.  I am converting from an unwieldly individual-octet field method of handling IP addresses to a simpler single IP field entry.

      The only question is how do I run a script on every record in a table?

        • 1. Re: Run script on every record to copy calculated field to new static field
          mgores

          You can do a replace field contents on your new field with the calculation you want to use.  Once you do that the new field will retain that value unless you manually change it or do the replace again.

          It will do this on the found set, so make sure you show all records if that is what you want.

          • 2. Re: Run script on every record to copy calculated field to new static field
            philmodjunk

            Since Replace Field contents can modify very large numbers of records all in one batch operation and cannot be undone, it's a good idea to make a back up copy of your file before trying this tool out for the first time. That way, you can toss the file and revert to your back up if you run the replace and get unexpected results.

            It's also a good tool to research in FileMaker help as it gives you a number of different useful options to choose from.

            • 3. Re: Run script on every record to copy calculated field to new static field
              boydcrow

              That worked a treat and saved me a couple of hours typing.  I did backup the database, always a good way to start the day.  Also, I noted the considerable warnings about using this as part of a user-initiated script.  I ran the script once, manually, then deleted it.

              Thanks for the quick response.

               

              In the nice-to-have department: a simple make-calculated-values-permanent would be nice, so as not to break existing relationships. I thought "Replace with Current Contents" would be the way to go.  However, it copies the one value from the current record into all records of the field - so, not.