StructGet

Description

Returns an array of structures from the specified path.

Syntax


StructGet(pathDesired)  

See also

StructDelete, StructFind, StructAppend, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew, StructUpdate, StructSort, StructFindKey, StructClear

Parameters

Parameter
Description
pathDesired
The pathname of the variable containing the structure or array from which ColdFusion retrieves the structure.

Usage

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

Example

<!--- 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 definded<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>



Banner.Novgorod.Ru