How to get a delimited List from an executed query in ColdFusion

ValueList() - get a delimited List from an executed query

ValueList.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ValueList Function example: how to get a delimited List from an executed query</title>
</head>

<body>
<h2 style="color:hotpink">ValueList Function Example</h2>

<cfquery name="qDepartments" datasource="cfdocexamples">
 SELECT Dept_ID, Dept_Name FROM DEPARTMENTS
</cfquery>
<cfdump var="#qDepartments#" label="Departments">
<br />
<cfset DepartmentList=ValueList(qDepartments.Dept_Name)>
<cfoutput>DepartmentList: #DepartmentList#</cfoutput>
</body>
</html>





More ColdFusion examples