Structcopy - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions

StructCopy

Returns a new structure with all the keys and values of the specified structure.
See also StructClear, StructDelete, StructFind, StructInsert, StructIsEmpty,
StructKeyArray, StructKeyArray, and StructUpdate.
Syntax
StructCopy( structure )
structure
Structure to be copied.
Usage
This function throws an exception if structure does not exist.
Example
<!--- This view-only example illustrates usage
of StructCopy. --->
<P>This file is similar to addemployee.cfm, which is called
by StructNew, StructClear, and StructDelete.
<!---
<CFSWITCH EXPRESSION="#ThisTag.ExecutionMode#">
<CFCASE VALUE="start">
<CFIF StructIsEmpty(attributes.EMPINFO)>
<CFELSE>
<CFOUTPUT><hr>Employee Add Complete
</CFCASE>
</CFSWITCH> --->
<CFOUTPUT>Error. No employee data was passed.</CFOUTPUT>
<CFEXIT METHOD="ExitTag">
tempStruct=StructCopy(EMPINFO)
<CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
INSERT INTO Employees
(FirstName, LastName, Email, Phone, Department)
VALUES
<CFOUTPUT>
(
'#StructFind(attributes.tempStruct, "firstname")#' ,
'#StructFind(attributes.tempStruct, "lastname")#' ,
'#StructFind(attributes.tempStruct, "email")#' ,
'#StructFind(attributes.tempStruct, "phone")#' ,
'#StructFind(attributes.tempStruct, "department")#'
)
</CFOUTPUT>
</CFQUERY>
</CFIF>
<P>#StructCount(attributes.tempStruct)# columns added.
</CFOUTPUT>
523

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents