How to find words and phrases as well (solved)
André.Bisseret
Andre.Bisseret at inria.fr
Tue Jan 31 04:05:14 EST 2006
Hi Éric,
Your script is superbe ! it works very well and very fast (on more
than three hundred cds).
In order to adapt your script to my app., I had only to replace "the
long name" by "theCode" of my cards ! Great! :-))
Nevetheless, I worked on this script to well understand it and I
learned a lot specially on how to use mark and unmark and also
"intersect" , with which I was not yet familiarl.
Thanks a lot to Jeanne, Jim and Wilheim for their ideas, questions and
suggestions. I learned a lot thanks to them too and sure I will use
them here or there. I much appreciate the tools I found in the site of
Wilheim.
all the best from Grenoble
André
Le Sunday, 29 Jan 2006, à 13:40 Europe/Paris, Eric Chatonet a écrit :
> Hello,
>
> I wrote my last mail from memory...
> You noticed that obviously it could not work :-(
> So, I dug in the "mark" solution for fun (a little bit longer but fast
> ;-)
>
> function FindCards,pList
> local tList1,tList2,tFirstList,tSecondList
> -----
> unmark all cds
> mark cds by finding whole item 1 of pList
> if the number of marked cds = 0 then return empty
> -----
> repeat with i = 1 to the number of marked cds
> put the long name of marked cd i & cr after tList1
> end repeat
> -----
> if the number of items of pList > 1 then
> repeat with i = 2 to the number of items of pList
> unmark all cds
> mark cds by finding whole (item i of pList)
> if the number of marked cds = 0 then return empty
> repeat with j = 1 to the number of marked cds
> do "put the long name of marked cd j & cr after tList" & i
> end repeat
> end repeat
> -----
> put CommonLines(tList1,tList2) into tFirstList
> repeat with i = 3 to the number of items of pList
> do "put tList" & i && "into tSecondList"
> put CommonLines(tFirstList,tSecondList) into tFirstList
> if tFirstList = empty then return empty
> end repeat
> return tFirstList
> -----
> else return tList1
> end FindCards
> --------------------------
> function CommonLines pFirstlist,pSecondlist
> local tFirstArray,tSecondArray
> -----
> repeat for each line thisLine in pFirstlist
> put true into tFirstArray[thisLine]
> end repeat
> repeat for each line thisLine in pSecondlist
> put true into tSecondArray[thisLine]
> end repeat
> intersect tFirstArray with tSecondArray
> return the keys of tFirstArray
> end CommonLines
>
>
> Le 29 janv. 06 à 12:30, Eric Chatonet a écrit :
>
>> Hi Andre,
>>
>> First you could use a comma as the delimiter in your list: this would
>> allow to have words and "phrases" at the same time.
>> Then just an idea I use often:
>>
>> unmark all cds
>> mark cds by finding whole item 1 of fld "Keywords"
>> repeat with i = 2 to the number of items of fld "Keywords"
>> mark cds by finding whole (item i of fld "Keywords") AND the mark
>> of this cd
>> end repeat
>>
>> Elegant and very fast ;-)
>> The process marks cards where all "items" are found at least one time.
>> The trick: you can specify more than one condition to mark cards...
>>
>> Then you can easily get the list of current marked cards or just
>> navigate through the marked cards only:
>> go next/prev marked cd
>>
>> Hope this helps.
>
> Best Regards from Paris,
> Eric Chatonet
> -----------------------------------------------------------------------
> -----------------------
> http://www.sosmartsoftware.com/ eric.chatonet at sosmartsoftware.com/
>
>
>
More information about the use-livecode
mailing list