Just by what valueList is doing, and what it's passed, I'm pretty sure
that it does most of it's work at compile time, not runtime. Thus any
kind of runtime expressions won't work. However, if you can make the
stuff that usually happens at compile time happen at runtime, it might
work. Try this:
lstData = evaluate("valueList(qryData.#sColumnName#)");
If that doesn't work, i think you're going to be stuck doing it
manually (looping the recordset and listAppending the column values
together).
cheers,
barneyb
On Tue, 24 Aug 2004 18:52:28 -0400, Roland Collins <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I'm working on something where I need to pass in a dynamic column name to
> the ValueList function. The problem is that it doesn't appear to support it
> because this function looks like it is an exception to the way that CF
> usually passes variables. I've tried the code below and many variations
> involving the Evaluate function all to no avail. This is eventually going
> to be parameterized and thrown into a CFC, which is why the need for the
> dynamic values. I'm trying to avoid using a loop and any manner of
> ListAppend or string catenation. Any thoughts?
>
> <CFSCRIPT>
> //These two values would be passed in to a CFC
> qryData = QueryNew("my_column");
> sColumnName = "my_column";
>
> //Make some dummy data
> QueryAddRow(qryData);
> QuerySetCell(qryData, "my_column", "my_first_value");
> QueryAddRow(qryData);
> QuerySetCell(qryData, "my_column", "my_second_value");
>
> //Won't work
> lstData = ValueList("qryData.#sColumnName#");
> //Won't work
> lstData = ValueList(Evaluate("qryData.#sColumnName#"));
>
> </CFSCRIPT>
>
> Thanks in advance,
> Roland Collins
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]