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

dereference an attribute name in query output?

Guest
Sep 24, 2008 Sep 24, 2008

Copy link to clipboard

Copied

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.
TOPICS
Advanced techniques

Views

413

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 ,
Sep 24, 2008 Sep 24, 2008

Copy link to clipboard

Copied

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().

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 ,
Sep 24, 2008 Sep 24, 2008

Copy link to clipboard

Copied

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!

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
Guest
Sep 24, 2008 Sep 24, 2008

Copy link to clipboard

Copied

LATEST
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.

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