comparing content of two fields
Peter Brigham MD
pmbrig at gmail.com
Thu Apr 28 08:41:39 EDT 2011
On Apr 27, 2011, at 11: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
Try this:
on mouseUp
put fld "All" into allEntries
put fld "Rural" into ruralEntries
set the itemDelimiter to tab
repeat with x = 1 to the number of lines in allEntries -- there are 1247 lines
if cr & (item 1 of line x of allEntries) & tab is in cr & ruralEntries 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 mouseUp
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list