> Hi, i hope this is a very simple question! but i want to be 
> able to call a query but i want the result of the query to be 
> stored in a structure format so that i can use in cfscript, 
> the only examples i can find is if the result is used in a 
> <cfoutput query"queryName"></cfoutput tags.
> 
> could someone possibly provide a simple example on how to 
> store the result in a sturcture format so that i can use it 
> in cfscript

Well, you can't really store a query in a structure, in a meaningful way. A
query is a two-dimensional representation of data - rows and columns. A
structure, by itself, is not. You could copy query data into a structure of
arrays, or a structure of structures, or an array of arrays, however.

Fortunately, though, there's no need to do this. You can simply reference
query values within CFSCRIPT. If you want to loop over a query, there's no
direct analog to CFOUTPUT but you can build a loop that does what you need.

<cfoutput query="qFoo">
#qFoo.col1#<br>
</cfoutput>

would be:

for (i = 1; i lte qFoo.RecordCount; i = i + 1) {
        WriteOutput(qFoo.col1[i] & "<br>");
}

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257519
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to