h, sorry, get row by cell value? then perhaps something like: <cfset mycell = "name"> <cfset findvalue = "jim"> <cfset rowstruct = structnew()>
<cfloop query="qry"> <cfif compare(qry[mycell][qry.currentrow],findvalue) eq 0> <cfloop list="#qry.columnlist#" index="i"> <cfset rowstruct[i] = qry[mycell][qry.currentrow]> </cfloop> </cfif> </cfloop> -----Original Message----- From: Johnny Le [mailto:[EMAIL PROTECTED] Sent: 29 March 2005 13:56 To: CF-Talk Subject: Re: Best practice question? Is there a way to capture a row? For example, if you know the value of a cell, can you do some structure or array search that would return the row? I know we can use query of queries to find it, but I wonder if you know another way using array or structure functions. Johnny >> -----Original Message----- > >It's definitely at least a little flakey (which is why I stressed testing >this stuff out first). It seems to only be an array on a direct access, not >an assignment. So the following all work fine: > >+) IsArray(QueryName["Column"]) does indeed return "Yes". > >+) <cfloop from="1" to="#ArrayLen(QueryName["Column"])#" index="Cnt"> works >just fine. > >+) ArrayToList(QueryName["Column"]) gives you a list of all column values >(as would "ValueList()"). > >However you're right: when making an assignment (which, I _think_ CFDump >does internally) you get the value of the first row. > >So <cfset foo = QueryName["Column"] /> has the same result as <cfset foo = >QueryName.Column /> > >However things get stranger still because this > ><cfoutput>#QueryName["Column"]#</cfoutput> > >actually results in a error ("Complex object types cannot be converted to >simple values.") were this > ><cfoutput>#QueryName.Column#</cfoutput> > >results in the output of the first cell of the column. > >So while you can use the indexed notation reference as an array nearly every >place you can't copy it. At least not simply - however you CAN duplicate >it! The following will get you your array: > ><cfset foo = Duplicate(QueryName["Column"]) /> > >"Foo" will now be an array of all values in the column. > >I'm sure that's not exhaustive, but I hope it at least frames how this works >and further underlines the point to test it out before you rely on it. > >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:200413 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54