RE: How to convert 1-record query to structure (EBW)

2002-11-24 Thread Jeffry Houser
At 12:47 AM 11/25/2002 -0500, you wrote:
>Thanks for the input.  I usually work with the Query object when getting
>record sets, but when I'm creating new or editing existing records (e.g.
>user or event), the form will pass all these fields to target tag (actually
>to index.cfm using Fusebox architecture), which will then validate them and
>pass them to a model fuseaction, which will finally pass them to a
>StoredProc to insert/update the table.
>
>So, in this case I'm looking to pass just the UserDetails structure, instead
>of the 10+ fields that it contains.  Hence, my apparently suboptimal desire
>to convert the 1-record query into a structure.

  I did not understand that this is what you were trying to do from the 
original post.  I bet writing a function to return a single row of a query 
might be good for these situations, because I can't think of a way off the 
top of my head to accomplish the task.

  I just looked.  Here is the function:


  It looks as if it uses a method similar to what we discussed, except it 
is using CFScript.  The function should work in both CF5 and CFMX.


>Thanks for your input and advice.  I do have & have read CF WACK (Forta),
>Instant CF (yours) and CFML Reference, but will flip through them again for
>variations on passing numerous fields for processing.

  ( Thanks for the support )


--
Jeffry Houser | mailto:[EMAIL PROTECTED]
DotComIt, Putting you on the web
AIM: Reboog711  | Phone: 1-203-379-0773
--
My CFMX Book: 

My Books: http://www.instantcoldfusion.com
My Band: http://www.farcryfly.com 

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.



RE: How to convert 1-record query to structure (EBW)

2002-11-24 Thread Erik Britt-Webb
Jeffry,

Thanks for the input.  I usually work with the Query object when getting
record sets, but when I'm creating new or editing existing records (e.g.
user or event), the form will pass all these fields to target tag (actually
to index.cfm using Fusebox architecture), which will then validate them and
pass them to a model fuseaction, which will finally pass them to a
StoredProc to insert/update the table.

So, in this case I'm looking to pass just the UserDetails structure, instead
of the 10+ fields that it contains.  Hence, my apparently suboptimal desire
to convert the 1-record query into a structure.

Thanks for your input and advice.  I do have & have read CF WACK (Forta),
Instant CF (yours) and CFML Reference, but will flip through them again for
variations on passing numerous fields for processing.

Thanks,
Erik

-Original Message-
From: Jeffry Houser [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 24, 2002 1:41 PM
To: CF-Talk
Subject: Re: How to convert 1-record query to structure (EBW)


At 10:15 AM 11/24/2002 -0500, you wrote:
>I'm selecting a single record from SQL Server and want to pass the results
>as a structured variable, rather than a query variable.  How do I obtain
the
>list of fields in the query so that I can loop through them?

  queryname.columnlist will give you the list of fields, but I'm not sure
why you would want to do this.

  First off, you do understand that you can access a query as a structure
of arrays?

  If you want to access the 10th record of a query, you can do this:
Queryname.Column[10]

  If you leave out the array index, the first row is automatically returned
(Unless you are looping over the query, the current row is returned )

  As far as this code:

>
>
>  
>
>
>Looping through collection:  works for valid struct or COM object, but not
>for query object
>
>
>
> UserRole.#var# = #UserRole[var]#
>
>


  You can loop through a query, using either cfloop or cfoutput, both with
the query attribute.  And then you can use cfloop to loop over the column
list.  So all of the above code can be condensed into something like this:


  http://livedocs.macromedia.com/cfmxdocs/dochome.jsp
  There is similar documents in the ColdFusion 5 Docs.

  If you want to buy a book, I can plug some of my own
  ( ColdFusion: A Beginner's Guide
<http://www.amazon.com/exec/obidos/ASIN/0072191090/instantcoldfu-20> or
ColdFusion: The Complete Reference:
<http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20> )



--
Jeffry Houser | mailto:[EMAIL PROTECTED]
DotComIt, Putting you on the web
AIM: Reboog711  | Phone: 1-203-379-0773
--
My CFMX Book:
<http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20>
My Books: http://www.instantcoldfusion.com
My Band: http://www.farcryfly.com


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



Re: How to convert 1-record query to structure (EBW)

2002-11-24 Thread Jeffry Houser
At 10:15 AM 11/24/2002 -0500, you wrote:
>I'm selecting a single record from SQL Server and want to pass the results
>as a structured variable, rather than a query variable.  How do I obtain the
>list of fields in the query so that I can loop through them?

  queryname.columnlist will give you the list of fields, but I'm not sure 
why you would want to do this.

  First off, you do understand that you can access a query as a structure 
of arrays?

  If you want to access the 10th record of a query, you can do this:
Queryname.Column[10]

  If you leave out the array index, the first row is automatically returned 
(Unless you are looping over the query, the current row is returned )

  As far as this code:

>
>
>  
>
>
>Looping through collection:  works for valid struct or COM object, but not
>for query object
>
>
>
> UserRole.#var# = #UserRole[var]#
>
>


  You can loop through a query, using either cfloop or cfoutput, both with 
the query attribute.  And then you can use cfloop to loop over the column 
list.  So all of the above code can be condensed into something like this:


  http://livedocs.macromedia.com/cfmxdocs/dochome.jsp
  There is similar documents in the ColdFusion 5 Docs.

  If you want to buy a book, I can plug some of my own
  ( ColdFusion: A Beginner's Guide 
 or 
ColdFusion: The Complete Reference: 
 )



--
Jeffry Houser | mailto:[EMAIL PROTECTED]
DotComIt, Putting you on the web
AIM: Reboog711  | Phone: 1-203-379-0773
--
My CFMX Book: 

My Books: http://www.instantcoldfusion.com
My Band: http://www.farcryfly.com 

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm



How to convert 1-record query to structure (EBW)

2002-11-24 Thread Erik Britt-Webb
I'm selecting a single record from SQL Server and want to pass the results
as a structured variable, rather than a query variable.  How do I obtain the
list of fields in the query so that I can loop through them?

I know how to loop through a collection of fields in a structured variable
and I know how to loop through a list of fields that I define, but I don't
know how to obtain the list of fields in a query.  Any tips would be great.
Below are the examples I do know.

Looping through query based on explicit list of fields



 


Looping through collection:  works for valid struct or COM object, but not
for query object



UserRole.#var# = #UserRole[var]#



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm