[comp.sys.mac.hypercard] Searching a stack for a user input string.

hovan@bgsuvax.UUCP (John Hovan) (05/17/88)

	First I would like to thank everyone that replied to my last
plea for help.  I have a script searching a stack and finding a list of a
user input string.  But, I am having one last problem.
        Right now, the stack is searching for the string and when found,
it is placing two field's from the card (with the found string) onto the
Cardlist.  The problem is that all the cards in the stack do not contain the
fields that I am placing in the Cardlist.  Thus, if a match is found in a card
where the fields are not present, a dreadfull error message is given.
        What I am looking for is a script that can check to see if a field
is present before doing the search on the particular card.  It probably can be
done with a variable, but I am a neophite to hypertalk.
 
 
                        Thanks again,
 
                                John Hovan
                                Bowling Green State University
                                Hardware Support
                                hovan@bgsuvax.uucp
                                N8JAA
 
 
My RAM is full... put your bits somewhere else!!!

edmoy@violet.berkeley.edu (05/18/88)

In article <2239@bgsuvax.UUCP> hovan@bgsuvax.UUCP (John Hovan) writes:
>
>        Right now, the stack is searching for the string and when found,
>it is placing two field's from the card (with the found string) onto the
>Cardlist.  The problem is that all the cards in the stack do not contain the
>fields that I am placing in the Cardlist.  Thus, if a match is found in a card
>where the fields are not present, a dreadfull error message is given.
>        What I am looking for is a script that can check to see if a field
>is present before doing the search on the particular card.  It probably can be
>done with a variable, but I am a neophite to hypertalk.

If the reason that your cards have different fields is because they belong
to different backgrounds, then the simplest thing to do is to name the back-
grounds and then when you find a card, test to see if the name of this
background is the one with the right name.

If the cards all share the same background, but some have (local) fields
and some don't, then I can think of several possible, though not satisfying
solutions.  The count of the fields may give enough information on the
existence of the fields you want.  If not, you can loop through the fields
on the card and check the names to see if you get a match.  This sounds
extremely slow and a real hack.

Edward Moy
Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy