filter command

yves COPPE yvescoppe at skynet.be
Thu Apr 11 02:09:00 EDT 2002


>At 6:49 pm +0200 10/4/02, yves COPPE wrote:
>
>>>This is better, I think.
>>>
>>>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
>>>      if tArray[tLine] = 1 then
>>>        put 2 into tArray[tLine]
>>>        put tLine & cr after tRetVal
>>>      end if
>>>    end repeat
>>>    delete char -1 of tRetVal
>>>    return tRetVal
>>>end commonLines
>>
>>
>>
>>How, now it's fine, your correction gives the best result.
>>Can you adapt your script for filtering lines in fld one that are
>>not in fld two and gives as result the lines in fld one that are NOT
>>in fld two.
>
>I think you just need to change the comparison in the above script:
>
>   if tArray[tLine] < 1 then
>
>At least, that will give you lines in pList2 that are not in pList1.
>
>Cheers
>Dave


thanks Dave, your 2 codes work very fine.
I use the first one to filter lines that are twice (or more) in a list fld

put fld "one" into tListOne
put fld "one" into tListTwo
put commonLines(tListOne,tListTwo) into myVar


Thank you for the help.
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list