Pick up a specified text on several card?

Jim MacConnell jmac at consensustech.com
Tue May 21 09:10:16 EDT 2002


Magnus, et.al.,

First, I'm a Revolution Newbie (still assessing Starter Kit) but, as I used
to be a HyperCard nut, I thought I'd chime in at the risk of being
completely off base.

I don't think using Find in a loop like this is doing what one might expect

> put field "sessions" into tempText
> repeat for each line xLine in tempText
> find thisDate
> put the value of foundline() & return after thisLine
> end repeat

What container if FIND looking in? At what point is FIND told to look in
line xLine of temptext? in tempText at all?

My understanding is that FIND looks for matches on cards unless you
specifically tell it to look in a field (which tempText isn't?). In this
case, FIND will keep on checking for thisDate in the entire stack, finding
multiple occurrences.... none of which need have any connection to
"Sessions" or its contents.

For example if field "Sessions" has four lines (even if they are empty),
this loop will find 4 occurrences of thisDate regardless of whether or not
they are in tempText.

Maybe something along the lines would be better
while line Xline of tempText does not contain tempDate
    put xline + 1 into xLine
    end repeat
put line Xline of tempText & return after thisLine


I sincerely hope I haven't missed something obvious and if I've made a
Newbie mistake, I apologize, in advance.

Jim 


> From: Magnus von Brömsen <webmaster at studioalice.se>
> Reply-To: use-revolution at lists.runrev.com
> Date: Sun, 19 May 2002 12:21:38 +0200
> To: use-revolution at lists.runrev.com
> Subject: Pick up a specified text on several card?
> 
> Hi
> 
> I want to collect some pecified lines of text from a field on a unknown
> number of cards. And put that text in another field on another card.
> 
> So, with this script I manage to get all the text from all the cards:
> 
> on mouseUp
> repeat for the number of cards
> put field "sessions" after tempText
> go to next card
> if cardIDs is 1040 then exit repeat --this is the card there all
> text is placed
> end repeat
> put tempText into field "result"
> end mouseUp
> 
> If I want to specified which lines to get something goes wrong:
> 
> on mouseUp
> put field "date" into thisDate --here I specifies which text to look
> for
> repeat for the number of cards
> put field "sessions" into tempText
> repeat for each line xLine in tempText
> find thisDate
> put the value of foundline() & return after thisLine
> end repeat
> go to next card
> if cardIDs is 1040 then exit repeat
> end repeat
> go to card "search"
> put thisLine into field "result"
> end mouseUp
> 
> The error is that the founded lines is repeated several times in the
> field "result" ?? (Maybe something with the "repeat for the number of
> cards" because the same text is repeated sometimes twice and sometimes
> three times.) But I can't figure out the pattern.
> 
> Can anyone give me a hint where to look...
> 
> magnus
> 
> 
> ------------------------------------------------------------------------------
> --
> "Jag lägger mig tidigt ­ för att snabbt få gå till jobbet. Igen..."
> ------------------------------------------------------------------------------
> --
> Studio Alice
> Magnus von Brömsen
> 0702-212 495
> 0322-633 833
> www.studioalice.se
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 





More information about the use-livecode mailing list