Another little SQL issue

Trevor DeVore lists at mangomultimedia.com
Wed Dec 28 01:19:54 EST 2005


On Dec 27, 2005, at 8:34 PM, Scott Kane wrote:
>
> What I'm trying to do is:
>
> put "SELECT * FROM users" into tSQL
>   --> EXECUTE SQL
>   put revdb_querylist(,,gConID,tSQL) into tList
>
>   handleRevDBerror tList
>   if the result is not empty then
>     answer warning the result
>     exit mouseUp
>   end if
>
>   put tList into fld "Users"
> ---------------------------
> That works fine.  What I need to do is add the tList
> elements to a group of normal Fields (edit boxes for
> clarity).  In the example there would be three of
> these:
>
> edName
> edEmail
> edSubscribed

Hi Scott,

The revdb_querylist function is just returning tab/cr delimited text  
so you can loop through all results like this:

set the itemDelimiter to tab
repeat for each line tResult in tList
	put item 1 of tResult &cr after tNames
	put item 2 of tResult &cr after tEmails
	put item 3 of tResult &cr after tSubscribed
end repeat

I'm not quite sure how your edit boxes are being used.  Are you  
trying to just put one of the records from the tList result into the  
edit boxes?  Or are you trying to edit all of the names, emails, etc.  
at once?  If you are just trying to edit one result at a time then I  
would probably modify the query to return the specific record you are  
after.

If you just want to work with all resorts at once then you could do  
this to get at record 3:

put item 1 of line 3 of tList into field "edName"
put item 2 of line 3 of tList into field "edEmail"
put item 3 of line 3 of tList into field "edSubscribed"


-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com





More information about the use-livecode mailing list