StructAppend

Description

Appends one structure to another. Always returns Yes.

Syntax


StructAppend(struct1, struct2, overwriteFlag) 

See also

StructDelete, StructFind, StructGet, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew, StructUpdate, StructSort, StructFindKey, StructClear

Parameters

Parameter
Description
struct1
The structure to append.
struct2
The structure containing the data appended to struct1.
overwriteFlag
Set to Yes to specify that values in struct2 overwrite corresponding values in struct1. The default is Yes.

Usage

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.

Example

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



Banner.Novgorod.Ru