comparing content of two fields

Joe Lewis Wilkins pepetoo at cox.net
Thu Apr 28 00:02:59 EDT 2011


Hi Ronald,

You can speed things up immeasurably by put the content of the fields into variables and then make your comparisons between the vars.  This is a universal truth. Always work with vars; not fields.

HTH,
 
Joe Lewis Wilkins
Architect & Director of Product Development for GSI
<www.glsysinc.com>








On Apr 27, 2011, at 8:55 PM, Ronald Zellner wrote:

> 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
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list