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

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>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy