<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>DUPLICATE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">DUPLICATE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Returns a clone, also known as a deep copy, of a variable. There is no reference to the original variable. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
A clone of a variable. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
Structure functions, System functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>Duplicate(variable_name)
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
StructCopy, other Structure functions; "Modifying a ColdFusion XML object" in Chapter&#160;35, "Using XML and WDDX," in ColdFusion MX Developer's Guide
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">History</span>
<p>
ColdFusion&#160;MX: Changed behavior: this function can be used on XML objects.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
Use this function to duplicate complex structures, such as nested structures and queries.
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>Note: </strong></td>
    <td>The Duplicate function throws an exception if you attempt to duplicate a CFC.</td>
  </tr>
</table><table>
  <tr valign="top">
    <td width="30"><strong>Note: </strong></td>
    <td>With this function, you cannot duplicate a COM, CORBA, or JAVA object returned from the cfobject tag or the CreateObject function. If an array element or structure field is a COM, CORBA, or JAVA object, you cannot duplicate the array or structure. </td>
  </tr>
</table>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;h3&gt;Duplicate Example&lt;/h3&gt;
&lt;cfset s1 = StructNew()&gt;
&lt;cfset s1.nested = StructNew()&gt;
&lt;cfset s1.nested.item = &quot;original&quot;&gt;
&lt;cfset copy = StructCopy(s1)&gt;
&lt;cfset clone = Duplicate(s1)&gt;
&lt;!--- modify the original ---&gt;
&lt;cfset s1.nested.item = &quot;modified&quot;&gt;
&lt;cfoutput&gt;
&lt;p&gt;The copy contains the modified value: #copy.nested.item#&lt;/p&gt;
&lt;p&gt;The duplicate contains the original value: #clone.nested.item#&lt;/p&gt;
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="VARIABLE_NAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VARIABLE_NAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Name of a variable to duplicate</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
