Whatever message this page gives is out now! Go check it out!

StructGet

Last update:
May 18, 2026

Description

Gets a structure(s) from a specified path.

Returns

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

Category

Syntax

StructGet(pathDesired)

See also

Structure functionsModifying a ColdFusion XML object in the Developing ColdFusion Applications

History

ColdFusion MX:
  • Changed behavior: this function can be used on XML objects.
  • Changed behavior: if there is no structure or array present in pathDesired, this function creates structures or arrays to make pathDesired a valid variable "path."

Parameters

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

Example

<cfscript>
       myStruct=StructNew();
       myStruct = { x = {y= { z=3.14 } }};
       WriteDump(structGet("myStruct.x.y.z") );//Displays 3.14
       WriteDump(structGet("myStruct.x.y") );
       WriteDump(structGet("myStruct.x") );
       WriteDump(myStruct);
</cfscript>

Output

Figure: StructGet output
StructGet output

Using empty struct and array of empty struct

<cfscript>
       myStruct=StructNew();
       myStruct = { x = {y= { z=3.14 } }};
       WriteDump(structGet("myStruct.x.y.a") );
       WriteDump(myStruct);
       WriteDump(structGet("myStruct.x.y") );
       WriteDump(structGet("myStruct.x") );
       WriteDump(myStruct);
</cfscript>
<cfscript>
       myStruct=StructNew();
       myStruct = { x = {y= { z=3.14 } }};
       WriteDump(structGet("myStruct.x.y.a[1]") );
       WriteDump(myStruct);
       WriteDump(structGet("myStruct.x.y") );
       WriteDump(structGet("myStruct.x") );
       WriteDump(myStruct);
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page