View comments | RSS feed

StructFindValue

Description

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.

Return value

An array that contains structures with values that match the search key value. If none are found, returns an array of size 0.

Category

Structure functions

Syntax

StructFindValue( top, value [, scope])

See also

Structure functions

Parameters

Parameter Description
top
ColdFusion object (a structure or an array) from which to start search. This attribute 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
  • one: function returns one matching key (default)
  • all: function returns all matching keys

Usage

The fields of each structure in the returned array are:

A structure's keys are unordered.

Example

<cfset aResults = StructFindValue( #request#, "235" )>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


Choopernickel said on Feb 13, 2003 at 3:10 PM :
I'm getting an error using this function while calling an array of structures: StructFindValue(array, "value")
Note: array[<i>N</i>] is a structure.

You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members.

The description of the "top" attribute reads:
ColdFusion object (a structure or an array) from which to start search. This attribute requires an object, not a name of an object.

Either it shouldn't, or the function should work the way it says it does.
girishpoojari said on Feb 19, 2003 at 10:49 PM :
ColdFusion gives an error when using StructFindValue function if the string being searched has space in it.
superbullet said on Apr 26, 2005 at 12:20 PM :
Is there a way I can tell the KEY field, that I want to find a datetime value that is more than 15 minutes from now?

For instance, I have:

<cfset test = structnew()>
<cfset test["datetime"] = "{ts '2005-04-26 14:48:45'}">

Now if I use structfindvalue:

<cfset result = structfindvalue(test, "<!--- date more than 15 minute from now --->", "ALL")>

How can I replace the comment with something that will find only the keys that have a datetime that is 15 minutores or more from now()?

Please help.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt294.htm