Whatever message this page gives is out now! Go check it out!

StructAppend

Last update:
May 18, 2026

Description

Appends one structure to another.

Returns

True, upon successful completion; False, otherwise.

Category

Syntax

StructAppend(struct1, struct2, overwriteFlag)

See also

Structure functionsModifying a ColdFusion XML object in the Developing ColdFusion Applications guide.

History

ColdFusion (2018 release): Introduced named parameters.
ColdFusion MX: Changed behavior: this function can be used on XML objects.

Parameters

Parameter
Description
struct1
Structure to which struct2 is appended.
struct2
Structure that contains the data to append to struct1
overwriteFlag
  • True or Yes: values in struct2 overwrite corresponding values in struct1. Default.
  • False or No: values in struct2 do not overwrite corresponding values in struct1.

Example

<cfscript>
       myS1={Name:"John",Age:30,Dept:"Marketing"};
       myS2={Street:"My Street",Avenue:"My Avenue",Building:50,zip:10101};
       WriteOutput("Appended Structs:");
       StructAppend(myS1,myS2,true);// Returns true
       // Displays appended structs
       WriteDump(myS1);
</cfscript>

Output

Figure: structappend output
structappend output

Using member function

<cfscript>
       myS1={Name:"John",Age:30,Dept:"Marketing"};
       myS2={Street:"My Street",Avenue:"My Avenue",Building:50,zip:10101};
       WriteOutput("Using member function:");
       WriteDump(myS1.append(myS2));
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page