Apparently, ValueList() WILL NOT WORK with a dynamic column name! (Make sure to read all the way thru because I did find a work around, using another function.)
I have tried the following methods of using a dynamic column name in a Value list function and I continuously get an error returned to me.
2query_id_list = ValueList(evaluate( 'query.' & key_fieldname ));
3query_id_list = ValueList(evaluate( 'query.#key_fieldname#' ));
4query_id_list = ValueList( query[key_fieldname] );
5//key_fieldname a variable that is set, before this code executes, to the main id column of the query we are using
6</cfscript>
After further research, I guess ValueList() will only work with a static column name, in this format:
2query_id_list = ValueList(query.main_id);
3//main_id being the actual name of the column in the table
4</cfscript>
Here's a nice little work around to this dilemma:
2query_id_list = ArrayToList( query[key_fieldname] );
3//key_fieldname is still a variable that is set, before this code executes, to the main id column of the query we are using
4</cfscript>
I'm not entirely sure why Adobe wouldn't allow ValueList() to accept a dynamic column name. Any ideas?
'Til next time, Bridget
Team Ravenglass
#1 by Scott Fitchet on 6/4/09 - 2:57 PM
#2 by Bridget on 6/5/09 - 3:15 PM
#3 by MPP on 6/10/10 - 11:21 AM
Thanks
#4 by par on 7/20/10 - 4:40 PM