Name

StructInsert

Synopsis

                  
                  
                  
                  StructInsert(structure, key, value [, allowoverwrite])

Inserts key and value into structure. Returns Yes if the operation is successful and No if it isn’t. Setting the optional allowoverwrite parameter to true allows overwriting of existing keys. The default is false. Here’s an example that inserts key/value pairs into a structure called Employee:

<cfset Employee=StructNew( )>
<cfset StructInsert(Employee, "Name", "Pere Money")>
<cfset StructInsert(Employee, "Title", "President")>
<cfset StructInsert(Employee, "Department", "Executive Management")>
<cfset StructInsert(Employee, "Email", "pmoney@example.com")>
<cfset StructInsert(Employee, "PhoneExt", "1234")>
   
<cfdump var="#Employee#">

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.