STRUCTUPDATE  
Description

Updates a key with a value.

 
Returns

True, on successful execution; if the structure does not exist, ColdFusion throws an error.

 
Category

Structure functions

 
Function syntax
StructUpdate(structure, key, value)
 
See also

Structure functions; "Modifying a ColdFusion XML object" in Chapter 35, "Using XML and WDDX," in ColdFusion MX Developer's Guide

 
History

ColdFusion MX: Changed behavior: this function can be used on XML objects.

 
Parameters

 
Example
<!--- This example shows the use of StructUpdate. --->
<p>This file is similar to addemployee.cfm, which is called by StructNew,
StructClear, and StructDelete. To test this file, copy the
&LT;CFELSEIF&GT; statement to the appropriate place in 
addemployee.cfm. It is an example of a custom tag used to add 
employees. Employee information is passed through the employee 
structure (the EMPINFO attribute). In UNIX, you must also add the Emp_ID.

<cfswitch expression = "#ThisTag.ExecutionMode#">
  <cfcase value = "start">
   <cfif StructIsEmpty(attributes.EMPINFO)>
    <cfoutput>Error. No employee data was passed.</cfoutput>
      <cfexit method = "ExitTag">
   <cfelseIf StructFind(attributes.EMPINFO, "department") EQ "">
    <cfscript>
     StructUpdate(attributes.EMPINFO, "department", "Unassigned");
    </cfscript>
    <cfexit method = "ExitTag">
         <cfelse> 

Structure to update

STRUCTURE  

Key, the value of which to update

KEY  

New value

VALUE