filter command

Dave Cragg dcragg at lacscentre.co.uk
Wed Apr 10 11:55:01 EDT 2002


At 4:05 pm +0200 10/4/02, yves COPPE wrote:
>Hello,
>
>
>I have two flds. There are list flds.
>I'd like to put in a variable the lines which are common to the two flds
>
The following function should do what you want. I'm sure there are other ways.

on mouseUp
  put commonLines(field 1, field 2)
end mouseUp

function commonLines pList1, pList2
   repeat for each line tLine in pList1
     put 1 into tArray[tLine]
   end repeat
   repeat for each line tLine in pList2
     add 1 to tArray[tLine]
   end repeat
   put keys(tArray) into tKeys
   repeat for each line tKey in tKeys
     if tArray[tKey] > 1 then
       put tKey & cr after tRetVal
     end if
   end repeat
   delete char -1 of tRetVal
   return tRetVal
end commonLines

Cheers
Dave Cragg



More information about the use-livecode mailing list