Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Query column to a list in ColdFusion

Tags:

I'm trying to convert ColdFusion query column to a list, what is the best way to do so?

I thought that there is a built in function that allows one to easily convert a query's column in to a list, if there is what is it?

like image 941
erikvold Avatar asked Mar 30 '11 17:03

erikvold


People also ask

How do I create a list in ColdFusion?

Creating Lists in ColdFusion In reality, you would probably create the list dynamically by looping through a set of items. You will often need to convert an array into a list or a list to an array (see below).

Is ColdFusion a query?

Gets metadata (such as the methods, properties, and parameters of a component) associated with an object that is deployed on the ColdFusion server. Determines whether a value is a query. contents of a one-dimensional array.


1 Answers

There is a built-in function to do that: ValueList

<cfset myList = ValueList(query.columnname)> 

As with all of the list functions, there's an optional delimiter attribute.

<cfset myList = ValueList(query.columnname,"|")> 

If you need the values in the list to have double-quotes around them, use QuotedValueList.

<cfset myList = QuotedValueList(query.columnname)> 
like image 189
ale Avatar answered Sep 22 '22 18:09

ale