next repeat problem

Sarah Reichelt sarahr at genesearch.com.au
Tue Aug 17 23:00:34 EDT 2004


On 18 Aug 2004, at 2:15 am, Rich Lague wrote:

> 	Is there a better way of excluding the blank lines in the field 
> "daTable" from my global variable?
>
Yes! Try this invaluable one-liner:

	filter fld "daTable" with "?*"

Although you won't need it, here is the fix for your repeat loop:
Instead of;
       if  line i is empty then next repeat

use:
       if line i of field "daTable" is empty then next repeat

Two other points which may prove useful in the future, with regard to 
the speed of your loop:
1. operations on fields are much slower than on variables. In this 
case, if you put fld "daTable" into a variable, then used the variable 
in the loop instead of the field itself, things would have been faster.
2. "repeat for each" is much, much faster than "repeat with".

For maximum efficiency, your loop could have been:
	put fld "daTable" into theTable
     repeat for each line L in theTable
       if L is empty then next repeat
       put item 1 of L & return after theList
     end repeat

Cheers,
Sarah



More information about the use-livecode mailing list