Compare two lists

dunbarx at aol.com dunbarx at aol.com
Mon Sep 2 17:10:36 CEST 2013


I agree with Monte about using arrays. I tried this:




on mouseUp
   get fld "oldList"
   repeat with y = 1 to the number of lines of it
      put item 1 of line y of it into tList["oldList"][y]["country"]
      put item 2 of line y of it into tList["oldList"][y]["city"]
      put item 3 of line y of it into tList["oldList"][y]["device"]
      put item 4 of line y of it into tList["oldList"][y]["counter"]
   end repeat
   
   get fld "newList"
   repeat with y = 1 to the number of lines of it
      put item 1 of line y of it into tList["newList"][y]["country"]
      put item 2 of line y of it into tList["newList"][y]["city"]
      put item 3 of line y of it into tList["newList"][y]["device"]
      put item 4 of line y of it into tList["newList"][y]["counter"]
   end repeat


   repeat with y = 1 to 4 --the number of lines of the keys of tList
      if tList["oldList"][y]["country"] <>  tList["newList"][y]["country"] then put "Line" && y & return after countryDif
      if tList["oldList"][y]["city"] <>  tList["newList"][y]["city"] then put "Line" && y & return after cityDif
      if tList["oldList"][y]["device"] <>  tList["newList"][y]["device"] then put "Line" && y & return after deviceDif
      if tList["oldList"][y]["counter"] <>  tList["newList"][y]["counter"] then put "Line" && y & return after counterDif
   end repeat
end mouseUp



Now this need refining, since it only reports the lines that are different between the two lists.


Craig Newman


More information about the use-livecode mailing list