Eliminate doubles in a long list field
Yves COPPE
yvescoppe at skynet.be
Sat Jun 28 01:24:01 EDT 2003
Le samedi, 28 juin 2003, à 07:57 Europe/Brussels, Ludovic Thébault a
écrit :
> I've a long list field with double entry
>
> I want to eliminate double.
>
> I use this script :
>
> repeat for each line l in myLongList
> if l is not in myLongListWithoutDouble then
> put l&cr after myLongListWithoutDouble
> end if
> end repeat
>
> But it's long. There is an another solution ? Thanks.
>
Hello Ludovic
here is a script I use to do the job between two flds
Very fast !!!
On mouseUp
put "" into fld "resultat"
put fld "listeUn" into tmpUn
put fld "listeDeux" into tmpDeux
put commonLines(tmpUn,tmpDeux) into fld "resultat"
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
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
You can easily do t he same on ONE list with something as :
put myLongList into tmpUn
put myLongList into tmpDeux
put commonLines(tmpUn,tmpDeux) into myLongList
Avec un petit bonjour de la Belgique vers la France !!
et heureux de te dépanner !
Greetings
Yves COPPE
yvescoppe at skynet.be
More information about the use-livecode
mailing list