That looks right. Maybe something else is happening. Is there any more code
to show?

Here's some sample code to show that what you're after should work...

<cfscript>
        st = StructNew();
        st.a = "A";
        a = "a";
</cfscript>

<cfoutput>
        <p>#st.a#</p>
        <hr />
        <p>#st["a"]#</p>
        <hr />
        <p>#st[a]#</p>
</cfoutput>

<hr /><hr />

<cfscript>
        ar = ArrayNew(1);
        ar[1] = StructNew();
        ar[1].a = "A";
        a = "a";
</cfscript>

<cfoutput>
        <p>#ar[1].a#</p>
        <hr />
        <p>#ar[1]["a"]#</p>
        <hr />
        <p>#ar[1][a]#</p>
</cfoutput>

You're not use shorthand to create any of the data collections are you? Like
a = [1,2,3]?

Adrian

-----Original Message-----
From: Richard White
Sent: 02 February 2008 11:04
To: CF-Talk
Subject: structures


Hi,

i can reference a structure to get the value no problem like this:

<cfoutput>#session.questionDetails[1].subjectID#</cfoutput>

but i need to be able to get data out without physically knowing the name of
the element, as a simple example i am trying to do it like this:

<cfset currentID = "subjectID">

<cfoutput>#session.questionDetails[1][currentID]#</cfoutput>

the error says that it cannot convert complex objects to simple values.

this is the same even if i try it like this:

<cfoutput>#session.questionDetails[1]["subjectID"]#</cfoutput>

can anyone help me realise what i am doing wrong.

thanks very much




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297998
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to