Tech Sharing

Tech Sharing

Advertisement

ColdFusion: ValueList Query to Array List

By on March 27, 2013

The most easy way to convert ColdFusion query column to array

tech.david-cheong.com

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

tech.david-cheong.com

<cfset myList = ValueList(query.columnname)>

tech.david-cheong.com
As with all of the list functions, there’s an optional delimiter attribute.

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

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

<cfset myList = QuotedValueList(query.columnname)>

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Comments

No Responses to “ColdFusion: ValueList Query to Array List”

Write a Comment

Captcha * Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: