Skip to main content
Inspiring
June 1, 2010
Question

Nested Structure Question

  • June 1, 2010
  • 1 reply
  • 522 views

Hi,

How can I get the value of a key that is in a nested structure?

I have this code

<cfset returnStruct = CreateObject('Component','someCFC').validateData( paramData ) />

<cfdump var="#returnStruct #" />

When I dump out "returnStruct" there are a few keys, I see the outermost structure, and in the first key of the outermost structure is a nested structure.  I'm trying to get the value of a specific key inside the nested structure.  The problem is the nested structure doesn't really have a name, it's just there

How can I do this? I should know this but can't recall how.  If someone can provide the syntax that would be great.

Thanks,

-ws

This topic has been closed for replies.

1 reply

Inspiring
June 1, 2010

The first thing one should do when confronted with finding out how to do something in CF is to consult the docs.  There's a section on how to use structs, and that covers what you need to know.

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec09f0b-7fe9.html

--

Adam

WestSideAuthor
Inspiring
June 1, 2010

Adam,

First and foremost, thanks for taking the time to reply.

I've looked at the docs first, typically I do that before posting.  On the flip side, because one posts on the forums, I don't think it's always fair to assume that they haven't looked at the docs

I've uploaded an image of the data structure I'm working with.

I'm trying to get the value of the key "INVALIDFIELDS" and can't quite get the syntax right.

-ws

WestSideAuthor
Inspiring
June 1, 2010

I ended up getting it using dot notation, for some reason I couldn't get at the value, but it's working now.

Thanks for your post.

-ws