StructUpdate(structure, key, value)
Structure functions; Modifying a ColdFusion XML object in the Developing ColdFusion Applications
ColdFusion (2018 release): Returns the updated struct.
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. |
<cfscript> myStruct=StructNew(); myStruct={a=1,b=2,c=3,d=4,e=5}; WriteOutput("Before struct update:"); WriteDump(myStruct); StructUpdate(myStruct,"e",6); // Update key-value pair e-5 to e-6 WriteOutput("After struct update:"); WriteDump(myStruct); </cfscript>

structupdate output
<cfscript> myStruct={a=1,b=2,c=3,d=4,e=5}; myStruct.update("e",6); WriteDump(myStruct); </cfscript>