Whatever message this page gives is out now! Go check it out!
StructFindValue( struct, value [, scope])Parameter | Description |
struct | ColdFusion structure from which to start search . This parameter requires an object, not a name of an object. |
value | String or a variable that contains one for which to search. The type must be a simple object. Arrays and structures are not supported. |
scope |
|
<cfscript>
myStruct=StructNew();// Create struct myStruct
myStruct={a=2,b=4,c=8,d=10,e=12,f=12};// Define keys in myStruct
myStruct.mySecondStruct=StructNew(); //Create nested struct mySecondStruct
myStruct.mySecondStruct.a1=50;//Define keys in mySecondStruct
myStruct.mySecondStruct.a2=12;
myStruct.mySecondStruct.myThirdStruct=StructNew();// Create another nested struct myThirdStruct
myStruct.mySecondStruct.myThirdStruct.b1=12;//Define keys in myThirdStruct
myStruct.mySecondStruct.myThirdStruct.b2=65;
myValue=StructFindValue(myStruct,"12","one");//Search for one default occurrence of "12" in the structs and return appropriate key
WriteDump(myValue);
</cfscript><cfscript>
myStruct=StructNew();// Create struct myStruct
myStruct={a=2,b=4,c=8,d=10,e=12,f=12};// Define keys in myStruct
myStruct.mySecondStruct=StructNew(); //Create nested struct mySecondStruct
myStruct.mySecondStruct.a1=50;//Define keys in mySecondStruct
myStruct.mySecondStruct.a2=12;
myStruct.mySecondStruct.myThirdStruct=StructNew();// Create another nested struct myThirdStruct
myStruct.mySecondStruct.myThirdStruct.b1=12;//Define keys in myThirdStruct
myStruct.mySecondStruct.myThirdStruct.b2=65;
myValue=StructFindValue(myStruct,"12","all");//Search all occurrences of "12" in the structs and return appropriate key
WriteDump(myValue);
</cfscript>