Little Known CF Functions: ValueList
July 27th, 2006
I saw a function today that I had actually never seen before, and it would have helped me save a few lines of code in many CF projects. The function is ValueList. ValueList takes a Query column as it’s first parameter, and a delimiter as an optional second parameter, and returns a list of the values from the query.
An example:
1 2 3 4 5 | <cfquery name="qryGetItems" datasource="#dsn#"> select items.item_name from items </cfquery> <cfset all_items = ValueList(qryGetItems.item_name)> |
You now have a comma delimited list of all items from your query.
