Re: Another little SQL issue

2005-12-28 Thread Jan Schenkel
--- Scott Kane <[EMAIL PROTECTED]> wrote:
> Hi again!
> 
> [snip]
> 
> Here's the issue.  I can populate a Table Field
> with the array resulting from a Select query with
> no problems.  What I don't seem to be able to get
> right is getting each element of that array into
> a normal Field object (as in an edit box).  It's
> the last issue I face as a matter of fact. 
> Pleasingly
> everything else is slipping into gear for me.
> 
> 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
> 
> So far (I've spent a few hours on this) I've failed
> overall.
> 
> In help greatly appreciated.
> 
> Scott 
> 

Hi Scott,

While the revdb_querylist() function will return a
tab-and-return- delimited list of the results of your
query, you can also use the revdb_query() function.
This returns a database cursor ID, which you can use
in the revdb_movefirst(), revdb_movenext(),
revdb_columnbyname() and some other functions and
names.
So if you want to display the contents of the colulns
of your first record of the query result in a couple
of fields, you can use something like:
--
  put "SELECT * FROM users" into tSQL
  --> EXECUTE SQL
  put revdb_query(,,gConID,tSQL) into tCursorID
  --> EXTRACT SOME FIELDS FROM THE FIRST RECORD IN THE
CURSOR
  put revdb_columnbyname(tCursorID,"edName") \
  into field "edName"
  put revdb_columnbyname(tCursorID,"edEmail") \
  into field "edEmail"
  put revdb_columnbyname(tCursorID,"edSubscribed") \
  into field "edSubscribed"
  --> DON'T FORGET TO CLOSE THE CURSOR WHEN YOU'RE
DONE
  get revdb_closecursor(tCursorID)
--

Hope this helped,

Jan Schenkel.

Quartam Reports for Revolution


=
"As we grow older, we grow both wiser and more foolish at the same time."  (La 
Rochefoucauld)




__ 
Yahoo! for Good - Make a difference this year. 
http://brand.yahoo.com/cybergivingweek2005/
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Another little SQL issue

2005-12-28 Thread Trevor DeVore

On Dec 27, 2005, at 11:17 PM, Scott Kane wrote:


Hi Trevor,


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.


Yes - one result at a time.  I can adapt the query for a single
record, but I'm still not able to implement your sample code.
Probably something I'm not understanding correctly...


Scott,

Can you provide some details about what didn't work right from the  
sample code?  What does your code look like?  What happened that you  
didn't expect?


--
Trevor DeVore
Blue Mango Multimedia
[EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: Another little SQL issue

2005-12-27 Thread Scott Kane
Hi Trevor,


> 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.

Yes - one result at a time.  I can adapt the query for a single
record, but I'm still not able to implement your sample code.
Probably something I'm not understanding correctly...

Scott


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Another little SQL issue

2005-12-27 Thread Trevor DeVore

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
[EMAIL PROTECTED]


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Another little SQL issue

2005-12-27 Thread Scott Kane
Hi again!

I've got another dumb Rev newbie issue with
databases.  I'm using SQLite still.  I thank
those who helped yesterday.  I really appreciated
it.  

Here's the issue.  I can populate a Table Field
with the array resulting from a Select query with
no problems.  What I don't seem to be able to get
right is getting each element of that array into
a normal Field object (as in an edit box).  It's
the last issue I face as a matter of fact.  Pleasingly
everything else is slipping into gear for me.

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

So far (I've spent a few hours on this) I've failed
overall.

In help greatly appreciated.

Scott 


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution