Duplicate - MACROMEDIA COLDFUSION 5 - CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION 5 - CFML:
Table of Contents

Advertisement

Alphabetical List of ColdFusion Functions

Duplicate

Description
Returns a clone, also known as a deep copy, of a variable. Unlike
Duplicate
Category
Structure functions
Duplicate(variable_name)
Syntax
See also
StructCopy
Parameters
Parameter
variable_name
This function is useful in duplicating complex structures, including nested structures
Usage
and queries.
Note
You cannot duplicate a COM, CORBA or JAVA object returned from the cfobject tag
or the
COM, CORBA, or JAVA object, you cannot duplicate the array or structure. If you try
to duplicate an object of this sort, an exception is thrown.
Example
<!--- This example shows the use of Duplicate --->
<html>
<head>
<title>Duplicate Example</title>
</head>
<H3>Duplicate Example</H3>
<cfset s1 = StructNew()>
<cfset s1.nested
<cfset s1.nested.item = "original">
<cfset copy = StructCopy(s1)>
<cfset clone = Duplicate(s1)>
<!--- modify the original --->
<cfset s1.nested.item = "modified">
<cfoutput>
<P>The copy contains the modified value: #copy.nested.item#</P>
<P>The duplicate contains the original value: #clone.nested.item#</P>
</cfoutput>
</body>
</html>
copies the variable, so there is no reference to the original variable.
Description
The name of a variable to duplicate
function. If an element in an array or a field of a structure is a
CreateObject
= StructNew()>
409
,
StructCopy

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Coldfusion 5

Table of Contents