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

QuotedValueList() - delimited List from an executed query

QuotedValueList.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QuotedValueList Function example: how to get a delimited List from an executed query (each value enclosed in single quotation marks)</title>
</head>

<body>
<h2 style="color:HotPink">QuotedValueList Function Example</h2>

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





More ColdFusion examples