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.
structFindValue(top, value [, scope])
returns array
struct.findValue( value, scope )
Name | Type | Required | Default | Description | Values | |
---|---|---|---|---|---|---|
top | any | Yes | CFML object (a structure or an array) from which to start search. This attribute requires an object, not a name of an object. |
|||
value | string | Yes | 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 | string | No | one: function returns one matching key (default) all: function returns all matching keys |
/Users/garethedwards/development/github/cfdocs/docs/functions/structfindvalue.md | all |
myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 };
myStruct.mySecondStruct = { a1=50, a2=12 };
myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 };
myValue=StructFindValue( myStruct, "12", "one" );
WriteOutput( serializeJSON( myValue ) );
myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 };
myStruct.mySecondStruct = { a1=50, a2=12 };
myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 };
myValue=StructFindValue( myStruct, "12", "all" );
WriteOutput( serializeJSON( myValue ) );
CF11+ calling the findValue member function on a struct.
myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 };
myStruct.mySecondStruct = { a1=50, a2=12 };
myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 };
myValue=myStruct.findValue( "12", "one" );
WriteOutput( serializeJSON( myValue ) );