next repeat problem

Rich Lague laguer at ucs.orst.edu
Tue Aug 17 15:41:50 EDT 2004


Thanks Klaus (and Jan!),

Yes, adding the complete descriptor for i did allow my 'next repeat' to 
run. However, I'm still having problems getting rid of the extra lines 
in my global variable.
I have also been trying your suggestion of using 'repeat for each'.

I get an error when I try to 'apply' this script--

---------------------------------------------------------------
set the itemdel to tab
repeat for each line i in fld "daTable"
if i = empty then
delete line i of fld "daTable"
else
put item 1 of field "daTable"  & return after theList
end if
end repeat

--------------------------------------------------------------
The error I get is "Chunk: error in chunk expression" and it highlights 
the line "put item 1 of field "daTable"  & return after theList" -- 
this is a line of the script that worked before...

Rich

On Tuesday, August 17, 2004, at 09:28  AM, Klaus Major wrote:

> Hi Rich,
>
>> I'm trying to get rid of blank lines in a global variable by using 
>> the "next repeat" control structure to stop them from being put into 
>> the variable in the first place. I keep getting errors-- but only 
>> when I include the "next repeat" line. Here is the script:
>>
>> on upDateTopicsRequest
>>   global theList, order, theListPlus, currentListNam
>>
>>   put empty into theList
>>   ask "Would you like to save your current list?"
>>   if it is empty then beep
>>   else
>>     put it into field "listName"
>>     put it into currentListNam
>>
>>     set the itemDelimiter to tab
>>     repeat with i = 1 to the number of lines in field "daTable"
>>    ##   if  line i is empty then next repeat
> ## Does this work?
>        if  line i of field "daTable" = empty then next repeat
> ## Need the complete descriptor for i...
>
>>       put item 1 of line i of field "daTable" & return after theList
>>     end repeat
>>     put the number of lines of theList into order
>>     put field "daTable" into theListPlus --extract the descriptors in 
>> productEval stack
>>
>>   end if
>>
>> end upDateTopicsRequest
>>
>>
>> 	"daTable" is a table field. If I exclude the "next repeat" line I do 
>> not get an error, but I get a lot of blank lines in the global 
>> variable "theList". This, in turn, causes other problems down the 
>> line. The error I get when I hit the "Apply" button is "if missing 
>> 'then'.
>> 	Is there a better way of excluding the blank lines in the field 
>> "daTable" from my global variable?
>
> If you have MANY lines you could save some time using "repeat for 
> each..."
>
> ...
> set the itemdel to TAB
> repeat for each line i in fld "daTable"
>    if i <> empty then
>       put item 1 of i & CR after theList
>    end if
> end repeat
> ...
>
> Insanely fast :-D
>
> Hope that helps...
>
>> Thanks,
>>
>> Rich Lague
>
> Regards
>
> Klaus Major
> klaus at major-k.de
> http://www.major-k.de
>
> _______________________________________________
> 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