Appends one structure to another. Always returns Yes.
StructAppend(struct1, struct2, overwriteFlag)
StructDelete, StructFind, StructGet, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew, StructUpdate, StructSort, StructFindKey, StructClear
This functions appends all the fields and values of struct2 to struct1; struct2 is not modified. If struct1 already contains a field of struct2, overwriteFlag determines if the value in struct2 will overwrite the value already in struct1. The default is to overwrite.
<html> <body> <!---- Create a Name structure ---> <CFSET nameCLK=StructNew()> <CFSET nameCLK.first="Chris"> <CFSET nameCLK.middle="Lloyd"> <CFSET nameCLK.last="Gilson"> <!--- Create an address struct ---> <CFSET addrCLK=StructNew()> <CFSET addrCLK.street="17 Gigantic Rd"> <CFSET addrCLK.city="Watertown"> <CFSET addrCLK.state="MA"> <CFSET addrCLK.zip="02472"> <!---- Create a Person structure ---> <CFSET personCLK=StructNew()> <CFSET personCLK.name=#nameCLK#> <CFSET personCLK.addr=#addrCLK#> <!--- Display the contents of the person struct before the Append ---> <p> The person struct <b>before</b> the Append call:<br> <cfloop collection=#personCLK# item="myItem"> <cfoutput> #myItem#<br> </cfoutput> </cfloop> <!--- Merge the Name struct into the top-level person struct ---> <CFSET bSuccess = StructAppend( personCLK, addrCLK )> <!--- Display the contents of the person struct, after the Append ---> <p> The person struct <b>after</b> the Append call:<br> <cfloop collection=#personCLK# item="myItem"> <cfoutput> #myItem#<br> </cfoutput> </cfloop>