ColdFusion: ValueList Query to Array List

The most easy way to convert ColdFusion query column to array

There are few ways to do the same thing, you may query out the data from the Database using query, than loop through all the row in the result set and append the item one by one. But the ColdFusion already come with the bulid-in function for the easy of programmer, the syntax is 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)>

Leave a Reply, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: