How to search?

Jim Ault JimAultWins at yahoo.com
Mon Jun 26 11:00:47 EDT 2006


On 6/26/06 1:33 AM, "Felix Theissen" <felix.theissen at freenet.de> wrote:

> I have a problem, I want to search a shared field for
> all occurencies of TextToFind.
> But what happens is:
> if I search with find chars, after finding all
> occurencies of TextToFind in the first card it skips to
> the next card and find the same TextToFind places
> in the shared field there. Setting the dontsearch propertys
> of all cards but the current one to true does not change anything.
> How can I achieve my goal to search the shared text field
> only in the current card?

There a few ways of approaching your goal

One - just before the find step, put the short id of this card into targetID
lockscreen, push card, then do the find until the short id of the found card
is not targetID, pop card.  If you are using closecard and opencard
handlers, you may also want to set lockmessages to true so those scripts do
not get triggered.

Two - get fld sharedGuy, then do offset(string, it) until you have found all
matches in the 'it' container and made a list (I suppose)

Three - create fld tempHolder, put fld sharedGuy into fld tempHolder, find
loop, delete fld tempHolder  --this way the only place text occurs is on
this card.. temporarily

Why do you need to use Find to locate the occurrences in a shared field?, as
opposed to other locating techniques that don't navigate?
Is this field a list, a single paragraph, or a whole bunch of text in
paragraphs?

If it is a list, I would suggest you use the filter command .. like so

get fld sharedGuy
filter it with "*"& findString &"*"
--now you have all the lines that contain the findString somewhere
--or all the paragraphs that contain the findString somewhere

Hope this helps

Jim Ault
Las Vegas






More information about the use-livecode mailing list