3 Replies Latest reply on Aug 5, 2009 11:32 AM by philmodjunk

    Record update looping script

    soomotom

      Title

      Record update looping script

      Post

      Hi all,

       

      I'm new at this stuff, please forgive my ignorance!

       

      I have a email db with contact information for a group of people.  

      I have a spreadsheet with 50 names who want to opt out.

       

      My main list of people is table 1 (T1)

      I was thinking of importing the spreadsheet into a table (T2).

      Run a script that would open the first record in T2 and look for the matching email address in T1.

      If found, update the record in T1 by adding 'opt-out' in the comment field.

      Loop back to record 2 in T2

       

      Is my logic good? (I may be way off on how to accomplish this)

      How do I begin?

       

      Thanks very much,

      Tom

        • 1. Re: Record update looping script
          philmodjunk
            

          This approach should work. You may also want to consider an "update matching records" version of Import Records. This method could eliminate the need for a script and additional table.

           

          Note: It's often a good idea to make a back up copy of a file before performing this kind of import so that you can throw the file out and try again if you don't get the results you expected when you imported your records.

          • 2. Re: Record update looping script
            soomotom
              

            Thanks, that import technique worked nicely. 

            I would be interested in knowing how to build the script, is it complex?

             

            Thanks,

            tm

            • 3. Re: Record update looping script
              philmodjunk
                

              A bit more complex than the import. However, there are cases where it makes sense to import into a secondary table--particularly when you can't be sure the data is perfect prior to import.

               

              Here's the script skeleton:

               

              Go To Layout [layoutname (Yourtemptable)]

              Go To Record [First]

              Loop

                //put your set field steps here to process the data

                Go To Record [Next ; Exit after last]

              End Loop