View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > QuotedValueList PreviousNext

QuotedValueList

Gets the values of each record returned from an executed query. ColdFusion does not evaluate the arguments.

A delimited list of the values of each record returned from an executed query. Each value is enclosed in single quotation marks.

Query functions

QuotedValueList(query.column [, delimiter ])

ValueList

Parameter

Description

query.column

Name of an executed query and column. Separate query name and column name with a period.

delimiter

A string or a variable that contains one. Character(s) that separate column data.

<h3>QuotedValueList Example</h3>
<!--- use the contents of one query to create another dynamically --->
<cfset List = "`BIOL', `CHEM'">
<!--- first, get the department IDs in our list --->
<cfquery name = "GetDepartments" datasource = "cfsnippets">
   SELECT Dept_ID FROM Departments
   WHERE Dept_ID IN (#PreserveSingleQuotes(List)#)
</cfquery>
<!--- now, select the courses for that department based on the
quotedValueList produced from our previous query --->
<cfquery name = "GetCourseList" datasource = "cfsnippets">
   SELECT *
   FROM CourseList
   WHERE Dept_ID IN (#QuotedValueList(GetDepartments.Dept_ID)#)
</cfquery>
<!--- now, output the results --->
<cfoutput QUERY = "GetCourseList" >
<pre>#Course_ID#   #Dept_ID#   #CorNumber#   #CorName#</pre>
</cfoutput>

Contents > CFML Reference > ColdFusion Functions > QuotedValueList PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


tzimmerman said on Apr 28, 2004 at 7:37 AM :
Editing the example as follows better illustrates what the QuotedValueList function does:

<!--- use the contents of one query to create another dynamically --->
<cfset List = "'BIOL', 'CHEM'">
<!--- first, get the department IDs in our list --->
<cfquery name = "GetDepartments" datasource = "cfsnippets">
SELECT Dept_ID FROM Departments
WHERE Dept_ID IN (#PreserveSingleQuotes(List)#)
</cfquery>
<!--- now, select the courses for that department based on the
quotedValueList produced from our previous query --->
<cfquery name = "GetCourseList" datasource = "cfsnippets">
SELECT *
FROM CourseList
WHERE Dept_ID IN ('#GetDepartments.Dept_ID#')
</cfquery>
<!--- now, output the results --->

List the course numbers that are in BIOL and CHEM (uses semicolon (;) as the delimiter:<br>
<cfoutput>
#QuotedValueList(GetCourseList.CorNumber,";")#<br>
</cfoutput>

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa59.htm