control scructure repeat and next line

hershrev hershbp at realtorsgroup.us
Tue Feb 17 19:36:48 EST 2004


On Tuesday, February 17, 2004, at 07:02 PM, Sarah Reichelt wrote:

>> This is the recipe I'm using. the field is "list behavior" and lock  
>> text is unchecked.
>> the problem is that it stays on the same line it doesn't move on to  
>> the next line and so on.
>> global myDbid,myLine,thisLine,mySql
>> on mouseUp
>>   put  
>> revOpenDatabase("PostgreSQL","127.0.0.1","test",postgres,myPassword)in 
>> to myDbid
>>   repeat for each line myL in field "field 1"
>>     put  the selectedText of field "field 1"  into mySql
>>     put revdb_execute(myDbid,mySql) after field "field 2"-- to see  
>> what is going on
>>     put the selectedLine of field "field 1" into field "field 3"-- to  
>> see what is going on
>>     wait for 1 second
>>     if the mouse is down then exit repeat
>>     end repeat
>> end mouseUp
>
> Each time through the loop, myL contains the text of each line of the  
> field. In the script above, you do not use this variable anywhere in  
> the loop. There is no code to change the selectedText so in effect,  
> you are using the number of lines as a counter, not to get any data.
Didn't get this last sentence "There is no code to change the  
selectedText so in effect, you are using the number of lines as a  
counter, not to get any data".
Other then that , it works great . You made in 5 minutes what I didn't  
do in 2 days. ( I said your a genius ) Thanks again.
By the way the "  put  
revOpenDatabase("PostgreSQL","127.0.0.1","test",postgres,myPassword)into 
  myDbid" I put before the repeat because it over loaded the db  
connections.

>
> Try this (assuming each line contains the SQL command you want to  
> execute):
>
> global myDbid,myLine,thisLine,mySql
> on mouseUp
>   put  
> revOpenDatabase("PostgreSQL","127.0.0.1","test",postgres,myPassword)int 
> o myDbid
>   repeat for each line myL in field "field 1"
>     put revdb_execute(myDbid, myL) after field "field 2"-- to see what  
> is going on
>     put myL into field "field 3"-- to see what is going on
>     wait for 1 second
>     if the mouse is down then exit repeat
>     end repeat
> end mouseUp
>
> If you want to see the selection move down the list as you go, then  
> you will have to change it in your scripts, using "set the  
> hilitedLine".
>
> Cheers,
> Sarah
>
> _______________________________________________
> 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