I just tried ArraySum(queryname["fieldname"]) and it works, but when I tried to get the array queryname["fieldname"], all I got is the value of the first row. I use <cfdump var="#queryname["fieldname"]#>. I used <cfset something = queryname["fieldname"]/>. None of them comes out as an array.
Johnny >> On Sun, 27 Mar 2005 15:06:43 -0500, Andrew Tyrone <[EMAIL PROTECTED]> >> wrote: >> > I might be crazy, but I seem to remember, at least in CF 4.x versions, >> that >> > if you scoped a query column within a cfoutput, it would only output the >> > data in the first row of the query, not the current row, no matter where >> you >> > were in the loop. > >Matt's right here, the basic rule doesn't change depending on scope, it >changes on situation. > >If your looping over the query (with a cfoutput or cfloop using the query >attribute) then doing "queryname.fieldname" will always output the current >row's value. > >If you're not looping over a query then "queryname.fieldname" will always >return the value of the first row as if you said "queryname.fieldname[1]". > >The odd thing is with queries should you use indexed notation you get a >different value. While the value of "queryname.fieldname" is the value of >the first row the value of "queryname["fieldname"]" is actually a reference >the column - essentially a one dimensional array containing all of the rows >values. > >For most everything you can use this as an array. To get the sum of a query >column, for example, you can do ArraySum(queryname["fieldname"]). > >This is a very powerful feature - but test it first. CFMX had some minor >bugs with this related to the fact that in some cases it counted the array >from zero (as Java) and not from one (as CF). > >Just to plug much of this information comes from my guide to CFML variables. >It's actually long overdue for a clean up (many of the links inside it are >dead and some information has changed since CF 6.0) but it's still rather >good if I do say so myself: > >http://www.depressedpress.com/DepressedPress/Content/Development/ColdFusion/ >Guides/Variables/Index.cfm > > >Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200201 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

