title: applescript to compare cell values and then place the value of one cell into another
body: <p>in a numbers app table i have the following data</p>
  
  <pre><code>   A          B                     C                 D
  user_id     login                user_id        login
  2039        Abbott, Rachael                     Adams, Sue
  110         Abbott, Shelby                      Adamson, Wendy
  2910        Abraham, Binu                       Anderson, Daryl
  121         Adams, Sue
  122         Adamson, Anne
  126         Adamson, Wendy
  </code></pre>
  
  <p>i am trying to write an applescript that will...</p>
  
  <ol>
  <li>iterate down logins in column D</li>
  <li>to find a matching login in column B</li>
  <li>take the value of the user_id in column A at the row where the match was found</li>
  <li>and place it into column C in the same row as the entry in column D</li>
  </ol>
  
  <blockquote>
  <pre><code>set dName to "correlationstudies.numbers"
  set sName to "users"
  set tName to "Table 1"
  set login_row to 2
  set login_w_id_row to 2
  
  tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
     repeat
        set login to value of cell login_row of column 4
        if login = "" then exit repeat
        set login_w_id_row to 2
  
        repeat
           set logincomp to value of cell login_w_id_row of column 2
           if logincomp = login then
              set value of cell login_row of column 3 to value of cell login_w_id_row of column 1
              exit repeat
           end if
           set login_w_id_row to login_w_id_row + 1
        end repeat
        set login_row to login_row + 1
     end repeat
  end tell
  </code></pre>
  </blockquote>