Well I don't see what's wrong with (2) that's the best way but you could

<cfset column = "myColumn"/>
<cfloop query="myQuery">
   evaluate("myQuery.#column#")
</loop>

Regards
Dale Fraser



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Mark Mandel
Sent: Monday, 22 May 2006 12:13 PM
To: [email protected]
Subject: [cfaussie] How do myQuery["columnName"] ?


Hey all,

This seems like a stupid question, but I can't seem to figure it

If I have a query, called 'myQuery' I can do:

(1)
<cfloop query="myQuery">
   myQuery.column
</loop>

and it will output fine.

I can do:
(2)
<cfset column = "myColumn"/>
<cfloop query="myQuery">
   myQuery[column][myQuery.currentRow]
</loop>

and it will output fine

But if I do:
(3)
<cfset column = "myColumn"/>
<cfloop query="myQuery">
   myQuery[column]
</loop>

I get the error:
Complex object types cannot be converted to simple values.

Is option (2) the only way to handle dynamic column names?

I had thought option 3 would work.. but it doesn't seem to...

Help?

Mark

-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to