StructFindValue(us,"62|-213") returns an array of match instances, so you cannot evaluate it in an if statement like that.
Instead, first check for StructFindValue returned value is an array and loop through it if you had than nested structures. <cfset us = StructNew()> <cfset us["andy"] = "62|-213"> <cfset us["jones"] = "207|-86"> <cfset us["cherry"] = "42|-220"> <cfset result=StructFindValue(us,"62|-213","ALL")> <cfoutput> <cfloop from="1" to="#ArrayLen(result)#" index="i"> #result[i].key#<br> </cfloop> </cfoutput> -----Original Message----- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, May 26, 2006 9:59 AM To: CF-Talk Subject: Finding matching values in a structure? I've got a structure containing coordinates for a grid. I've named each line for the person who should appear at those coordinates. I've found a function called "StructFindValue()" that "says" it can do what I need, but everytime I try to use it, I get an error. According to the docs it "Searches recursively through a substructure of nested arrays, structures, and other elements for structures with values that match the search key in the value parameter.". It says that it returns "An array that contains structures with values that match the search key value. If none are found, returns an array of size 0." I determined that I can't use it in a CFIF statement because it returns an array. So how would I go about "finding" a key containing the value? Here's my code listed below: <cfset us = StructNew()> <cfset us["andy"] = "62|-213"> <cfset us["jones"] = "207|-86"> <cfset us["cherry"] = "42|-220"> <cfdump var="#StructFindValue(us,"62|-213")#"> <cfif StructFindValue(us,"62|-213","ALL")> gotcha </cfif> <!----------------//------ andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241617 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