Alan Holden said the following on 10/13/2010 12:09 PM:
<cfset result = evaluate("myStruct.keyNo_#i#")>
<cfset result = StructFindValue( #myStruct#, "keyNo_#i#" )>
<cfset result = myStruct['keyNo_#i#']>
I'd go with the [] bracket notation first.
I think you mean to use StructFindKey. StructFindValue recursively
loops over all the struct keys and returns an array of key names that
match the passed value.
StructFindKey is going to loop (recursively) over all the keys in the
struct to find a match. It's an "exhaustive" search whereas the bracket
notation tries one key and if it's not there -- fails.
Evaluate on OpenBD isn't as slow as it is on ACF. But I'd choose
bracket notation over evaluate() even if evaluate() was slightly faster
for the sake of being able to read the code.
.pjf
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
official manual: http://www.openbluedragon.org/manual/
Ready2Run CFML http://www.openbluedragon.org/openbdjam/
mailing list - http://groups.google.com/group/openbd?hl=en