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

nested variables in cfquery

Guest
Sep 17, 2009 Sep 17, 2009

Hi,

I have a query which is called "myQuery" and I want to have the value of a field in myQuery like below:

myValue= #myQuery.FirstName#

But the name of the field is in another variable: #myfield#. So, I want :

myValue= #myQuery.#myfield##

But this statement cause an error as it has nested variables.

Could any body help me to solve my problem?

1.1K
Translate
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

correct answers 1 Correct answer

LEGEND , Sep 17, 2009 Sep 17, 2009

One can refer to a query cell via this notation:

query[columnName][rowNumber]

Where "query" is the query variable, "columnName" is a string (or string variable) representing the column name and rowNumber is a positive integer (or variable holding same) representing the row number.

I can't actually find this in the docs, strangely.

--

Adam

Translate
LEGEND ,
Sep 17, 2009 Sep 17, 2009

One can refer to a query cell via this notation:

query[columnName][rowNumber]

Where "query" is the query variable, "columnName" is a string (or string variable) representing the column name and rowNumber is a positive integer (or variable holding same) representing the row number.

I can't actually find this in the docs, strangely.

--

Adam

Translate
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
Valorous Hero ,
Sep 17, 2009 Sep 17, 2009

I can't actually find this in the docs, strangely.

It is mentioned in a few places, I think. Unfortunately, none of them are where most people would think to look for it IIRC.

Translate
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 17, 2009 Sep 17, 2009

It's mentioned - in passing - here.

There's no mention of this, or cross reference to this, or any suggestion it's relevant at all on the <cfquery> page, which is... oh, I dunno... it's predictable of livedocs, really.

--

Adam

Translate
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
Valorous Hero ,
Sep 18, 2009 Sep 18, 2009

It's mentioned - in passing - here

Oh, yeah. Definitely not in my top ten list of likely places.

-Leigh

Translate
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 21, 2009 Sep 21, 2009
LATEST

Thanks Adam.

Mandana

Translate
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