comparing content of two fields

Ronald Zellner zellner at tamu.edu
Wed Apr 27 23:55:12 EDT 2011


I  have two data fields that have multiple tabbed columns,
 I want to determine which items in the main field (1247 lines)  also appear in the second field (436 lines).

Using this code to compare line by line:

on mouseUp

   set the itemDelimiter to tab
   repeat with x = 1 to the number of lines in field "All" -- there are 1247 lines

      repeat with y = 1 to the number of lines in field "Rural"  --there are 436 lines
         if item 1 of line x of field "All" = item 1 of line y of field "Rural" then
            put "Rural" into item 4 of line x of field "All"
            set the textColor of line x of field "All" to "red"
            exit repeat
         else
            put "-" into item 4 of line x of field "All"
         end if
         
      end repeat
   end repeat
end mouseUp


This seems to function properly, but

    1.   it is very, very slow
    2.  The results do not show up until the whole set is completed, not as each line is checked.

Any thoughts on a better way to approach this?

Ron


More information about the use-livecode mailing list