View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > StructGet PreviousNext

StructGet

Gets a structure(s) from a specified path.

An alias to the variable in the pathDesired parameter. If necessary, StructGet creates structures or arrays to make pathDesired a valid variable "path."

Structure functions

StructGet(pathDesired) 

Structure functions

ColdFusion MX:

Parameter

Description

pathDesired

Pathname of variable that contains structure or array from which ColdFusion retrieves structure.

You can inadvertently create invalid structures using this function. For example, if array notation is used to expand an existing array, the specified new element is created, regardless of the type currently held in the array.

<!--- GetStruct() test --->
<cfset test = StructGet( "dog.myscope.test" )>
<cfset test.foo = 1> 
<cfif NOT IsDefined("dog")>
   Dog is not defined<br>
</cfif>
<cfif NOT IsDefined("dog.myscope")>
   Dog.Myscope is not defined<br>
</cfif>
<cfif NOT Isdefined("dog.myscope.test")>
   Dog.Myscope.Test is not defined<br>
</cfif>
<cfif NOT Isdefined("dog.myscope.test.foo")>
   Dog.Myscope.Test.Foo is not defined<br>
</cfif>
<cfoutput>
   #dog.myscope.test.foo#<br>
</cfoutput>
<cfset test = StructGet( "request.myscope[1].test" )>
<cfset test.foo = 2>
<cfoutput>
   #request.myscope[1].test.foo#<br>
</cfoutput>
<cfset test = StructGet( "request.myscope[1].test[2]" )>
<cfset test.foo = 3>
<cfoutput>
   #request.myscope[1].test[2].foo#<br>
</cfoutput>

Contents > CFML Reference > ColdFusion Functions > StructGet PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


--coolburn-- said on Oct 24, 2003 at 12:45 PM :
There is a misspelling on this page; oathDesired should be pathDesired.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa97.htm