Name

StructFindValue

Synopsis

                  StructFindValue(top, value [, scope])

Searches complex structures for values matching the value parameter. top specifies the starting point to begin the search. value specifies the actual value you want to search for. scope is optional and may be set as either One or All, specifying the number of matches that should be returned. The default scope is One. StructFindValue( ) returns an array containing one structure for each value matched by the search. Each structure contains the following keys:

Key

The key holding the found value

Path

A string that can be used with other functions to reference the found value

Owner

The parent object containing the found value

Here’s an example that demonstrates this function:

<!--- Create a structure of nested arrays containing nested structures. ---> <cfset Stock.Company = "Example.com"> <cfset Stock.Ticker = "EXAMP"> <cfset Temp = StructGet("Stock.TradeInfo[1]")> <cfset Temp.Price = 60> <cfset Temp.TradeDate = "6/11/02"> <cfset Temp.Volume = 750000> <cfset Temp.Day.High = 62> <cfset Temp.Day.Low = 59> <cfset Temp = StructGet("Stock.TradeInfo[2]")> <cfset Temp.Price = 63> <cfset Temp.TradeDate = "6/12/02"> <cfset Temp.Volume = 737000> <cfset Temp.Day.High = 66> <cfset Temp.Day.Low = 60> <cfset Temp = StructGet("Stock.TradeInfo[3]")> <cfset Temp.Price = 67> <cfset Temp.TradeDate = "6/13/02"> <cfset Temp.Volume = 1220000> <cfset Temp.Day.High = 67> <cfset Temp.Day.Low = 66> <!--- Change the value of ValueToFind to see ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.