Adobe ColdFusion 8

ValueList

Description

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

Returns

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

Category

List functions, Query functions

Function 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. The default value is comma (,).

Example

<h3>ValueList Example</h3>

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

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

Value list of all BIOL Course ID's using (--) as the delimiter:<br>
<cfoutput>
#ValueList(GetCourseList.Course_ID,"--")#<br> 
</cfoutput>

Value list of all BIOL Course Numbers using (;) as the delimiter:<br>
<cfoutput>
#ValueList(GetCourseList.CorNumber,";")#<br> 
</cfoutput>