View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > StructUpdate PreviousNext

StructUpdate

Updates a key with a value.

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

Structure functions

StructUpdate(structure, key, value)

Structure functions

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

Parameter

Description

structure

Structure to update

key

Key, the value of which to update

value

New value

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

Contents > CFML Reference > ColdFusion Functions > StructUpdate PreviousNext

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

Version 6.1

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

Comments


tomp said on Jan 10, 2004 at 5:37 AM :
StructUpdate throws an error if the specified key does not exist.

This is omitted from the documentation.

 

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

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funca105.htm