How to get the value associated with a key in a structure in ColdFusion

StructFind() - find the value associated with a key in a structure

StructFind.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructFind function example: how to get (find) the value associated with a key in a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructFind Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LemonChiffon">
<cfset Color.Value="##FFFACD">
<cfdump var="#Color#" label="Color">

<br />
<cfset NameKey=StructFind(Color,"Name")>

<cfoutput>
<b>
Color Structure Name key: #NameKey#
</b>
</cfoutput>
</body>
</html>





More ColdFusion examples