ValueList

Description

Inserts a delimiter between each value in an executed query. ColdFusion does not evaluate the arguments.

Return value

A delimited list of the values of each record returned from an executed query.

Category

Other functions, Query functions

Syntax

ValueList(query.column [, delimiter ]) 

See also

QuotedValueList

Parameters

Parameter Description
query.column
Name of an executed query and column. Separate query name and column name with a period.
delimiter
A delimiter character to separate column data items.

Example

<h3>ValueList Example</h3>

<!--- use the contents of a query to create another dynamically --->
<cfquery name = "GetDepartments" datasource = "cfsnippets">
  SELECT Dept_ID FROM Departments
  WHERE Dept_ID IN ('BIOL')
</cfquery>

<cfquery name = "GetCourseList" datasource = "cfsnippets">
SELECT *
  FROM CourseList
  WHERE Dept_ID IN ('#ValueList(GetDepartments.Dept_ID)#')
</cfquery>

<cfoutput QUERY = "GetCourseList" >
<pre>#Course_ID#  #Dept_ID#  #CorNumber#  #CorName#</pre>
</cfoutput>

Comments