– Common Function Library Project

DynamicValueList(query, col[, delim])

Last updated August 14, 2002


Raymond Camden

Version: 1 | Requires: CF5 | Library: DataManipulationLib

The CFML function, ValueList, does not allow you to grab a column dynamically unless you use the evaluate function. This UDF allows you to grab a list of values from one particular column.

Return Values:
Returns a list.


<cfset test = queryNew("name,age")>
<cfloop index="x" from=1 to=5>
	<cfset queryAddRow(test)>
	<cfset querySetCell(test,"name","Random Name #randRange(1,10000)#")>
	<cfset querySetCell(test,"age","#randRange(1,100)#")>
<cfdump var="#test#">
<cfdump var="#DynamicValueList(test,"name")#">


Name Description Required
query The query to examine. Yes
col The column to return values for. Yes
delim Delimiter. Defaults to comma. No

Full UDF Source:

 * Returns a value list from a dynamic column of a query.
 * @param query 	 The query to examine. (Required)
 * @param col 	 The column to return values for. (Required)
 * @param delim 	 Delimiter. Defaults to comma. (Optional)
 * @return Returns a list. 
 * @author Raymond Camden ( 
 * @version 1, August 14, 2002 
function DynamicValueList(query,col) {
	var delim = ",";
	if(arrayLen(arguments) gte 3) delim = arguments[3];
	return arrayToList(query[col],delim);
blog comments powered by Disqus


Latest Additions

Kevin Cotton added
May 5, 2016

Raymond Camden added
April 25, 2016

Chris Wigginton added
January 18, 2016

Gary Stanton added
November 19, 2015

Sebastiaan Naafs - van Dijk added
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson