Skip to main content
September 24, 2008
Question

dereference an attribute name in query output?

  • September 24, 2008
  • 2 replies
  • 505 views
Is there a way to dereference an attribute name in query output?
That may not be the clearest question. But if you look at the attached you can see what I am trying to do.

The "Evaluate" function in the attached code generates the following error:
A CFML variable name cannot end with a "." character.
This topic has been closed for replies.

2 replies

Inspiring
September 24, 2008
Remember all cf variables are in some sort of struct, and then you can use array notation. Evaluate() is very bad and if you find yourself using it you are doing something wrong!
September 24, 2008
quote:

Originally posted by: Stressed_Simon
Remember all cf variables are in some sort of struct, and then you can use array notation. Evaluate() is very bad and if you find yourself using it you are doing something wrong!


I did not know that. You read my mind. I am going to change all the Evaluate's in my current project. Thank you for your fast response.
Inspiring
September 24, 2008
wolfv wrote:
>
> <cfouput query="q">
> #Evaluate( q.#attributeName#[currentRow] )# <br />
> </cfoutput>
>

Well there you have it. I did it right for the row. Why don't you use
the same array notation for the column or attribute as you called it.

#q[attributeName][currentRow]#

Note: No need for evaluate().