• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Nested Structure Question

Engaged ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

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

TOPICS
Advanced techniques

Views

424

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

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.

ss_structure.gif

-ws

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

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

Actually, around here it usually is safe to assume people haven't read the docs, because that's - say 75% (?) of the time - accurate.  You're the exception.

I base my replies to people on the info they provide in their initial postings: you didn't mention anything about reading docs or trying anything out, so assumed you hadn't, sorry.  Again, running on such assumptions is more often going to be right than wrong around here.

Anyway, glad you got it sorted out.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 01, 2010 Jun 01, 2010

Copy link to clipboard

Copied

LATEST

No worries.. thanks Adam.

-ws

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation