Remote Find Questions

Wouter wouter.abraham at pi.be
Sat Mar 27 09:09:58 EST 2004


On 27 Mar 2004, at 14:26, use-revolution-request at lists.runrev.com wrote:


snip


> go invisible to card startingCard of stack "My Database.sdb"
> repeat
>    if searchKeys then find targetText in field "Record Key"
>    else find targetText in field "Record"
>    if the result is "Not Found" then exit repeat
>    get the number of this card
>    if it < startingCard or it > endingCard then exit repeat
>    [processing logic]
>    go next
> end repeat
>
> Can I use defaultStack to accomplish this remotely -- multiple
> searches beginning at a specific starting card and repeating until
> find goes past a specific ending card?  If so; can you flesh out the
> example a little to demonstrate, please?
> -- 
>
> Rob Cozens
> CCW, Serendipity Software Company
> http://www.oenolog.net/who.htm
>

Hi Rob,

If your database is a pile of cards then marking the cards is faster 
than finding.
According to your example you will have to call the following function 
twice.
(but this should be no problem as  it is pretty fast, no need to go 
invisible, no need to lock anything.)

-- put findTheDamnThing( "My Database.sdb","Chateau Chasse 
Spleen","Record Key") into tFirstResult
-- put findTheDamnThing( "My Database.sdb","Chateau Chasse 
Spleen","Record") into tSecondResult

function findTheDamnThing stack2Search, targetText, fldName
   put the defaultstack into tOldDefault
   set the defaultstack to  stack2Search
   mark cards  where fld fldName  contains  targetText
### mark cards  by finding  targetText [in  fld fldname]  ### mucho 
slower
   if the number of marked cards = 0 then put "not found" into tCollector
   else
     repeat with i = 1 to the number of marked cards
       put the long id of marked cd i & cr after tCollector
       ### put the id of marked cd i & cr after tCollector
     end repeat
   end if
   unmark all cards
   set the defaultstack to tOldDefault
   return tCollector
end findTheDamnThing

Once you have the list of cards then you apply the processing logic.
Or you can adapt the function to do it all in 1 pass.

HTH,
Greetings,
WA



More information about the use-livecode mailing list