MACROMEDIA COLDFUSION MX 61-CFML Reference page 694

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

Advertisement

Variable type
structure.object
structure.query
Example
<!--- This code shows assignment by-value and by-reference. --->
// This script creates a structure that StructCopy copies by value. <br>
<cfscript>
// Create elements.
s = StructNew();
s.array = ArrayNew(2);
// Assign simple values to original top-level structure fields.
s.number = 99;
s.string = "hello tommy";
// Assign values to original top-level array.
s.array[1][1] = "one one";
s.array[1][2] = "one two";
</cfscript>
<!--- Output original structure --->
<hr>
<b>Original Values</b><br>
<cfoutput>
// Simple values <br>
s.number = #s.number#<br>
s.string = #s.string#<br>
// Array value <br>
s.array[1][1] = #s.array[1][1]#<br>
s.array[1][2] = #s.array[1][2]#<br>
</cfoutput>
// Copy this structure to a new structure. <br>
<cfset copied = StructCopy(s)>
<cfscript>
// Change the values of the original structure. <br>
s.number = 100;
s.string = "hello tommy (modified)";
s.array[1][1] = "one one (modified)";
s.array[1][2] = "one two (modified)";
</cfscript>
<hr>
<b>Modified Original Values</b><br>
<cfoutput>
// Simple values <br>
s.number = #s.number#<br>
s.string = #s.string#<br>
// Array value <br>
s.array[1][1] = #s.array[1][1]#<br>
s.array[1][2] = #s.array[1][2]#<br>
</cfoutput>
<hr>
<b>Copied structure values should be the same as the original.</b><br>
<cfoutput>
// Simple values <br>
copied.number = #copied.number#<br>
694
Chapter 3: ColdFusion Functions
Assigned by
Reference
Reference

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents