StructCopy

Returns a new structure with the all keys and values of the specified structure.

See also StructClear, StructDelete, StructFind, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, and StructUpdate.

Syntax

StructCopy(structure)
structure

Structure to be copied.

Usage

This function throws an exception if structure does not exist.

Example

<!--- This example shows the use of StructCopy --->
<!---------------------------------------------------------------
This example assumes that you have created and assigned values
to the fields of a structure named EMPINFO.
----------------------------------------------------------------->
<CFIF StructIsEmpty(EMPINFO)>
        <CFOUTPUT>Error. EMPINFO is empty.</CFOUTPUT>
<CFELSE>
        <CFSET tempStruct=StructCopy(EMPINFO)>
        <CFQUERY NAME="AddEmployee" DATASOURCE="HRAPP">
          INSERT INTO Employees
              (Employee_ID, FirstName, LastName, Department_ID, StartDate, 
Salary, Contract)
            VALUES 
              <CFOUTPUT>
                (
                 `#StructFind(tempStruct, "Employee_ID")#' ,
                 `#StructFind(tempStruct, "FirstName")#' ,
                 `#StructFind(tempStruct, "LastName")#' ,
                 `#StructFind(tempStruct, "Department_ID")#' ,
                 `#StructFind(tempStruct, "StartDate")#' ,
                 `#StructFind(tempStruct, "Salary")#'
                 `#StructFind(tempStruct, "Contract")#'
                )
              </CFOUTPUT> 
          </CFQUERY>
</CFIF>
<HR>Employee Add Complete
<CFOUTPUT>
         <P>#StructCount(tempStruct)# columns added.
</CFOUTPUT>
...