Name

StructFindKey

Synopsis

                  StructFindKey(top, key [, scope])

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

Value

The value held by the found key

Path

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

Owner

The parent object containing the found key

The following example demonstrates the use of this function on a structure containing an array of nested structures:

<!--- 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 ...

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.