> -----Original Message-----
> From: C. Hatton Humphrey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 13, 2005 2:11 PM
> To: CF-Talk
> Subject: Re: Easy way to get data from a single query row into a
> structure?
> 
> > Is there a simple way to do that?  I realize there is the
> > queryname.columnlist variable returned with cfquery, would there be an
> > easy way to grab that record as a single query object or structure
> > that I could then serialize into WDDX and store in my new table?
> 
> I fiddled around with it and the only one that really worked for me was:
> 
> <cfset TestStruct = StructNew()>
> <cfloop List="#ThisQuery.ColumnList#" index="ThisItem">
>   <cfset temp = StructInsert(TestStruct, "#ThisItem#",
> Evaluate("ThisQuery.#ThisItem#[4]"))>
> </cfloop>

You won't need the evaluate if you use indexed notation to access the data.

Instead of this:

Evaluate("ThisQuery.#ThisItem#[4]")

Use this:

ThisQuery[ThisItem][4]

It will save you some significant time over a large number of iterations.

Also you generally don't need the "Temp" setting you can just do this:

<cfset StructInsert(TestStruct, ThisItem, ThisQuery[ThisItem][4])>

This will also save you some resources in those long hauls.

Jim Davis





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202648
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to