Using Coldfusion's ValueList() to evaluate dynamic Query column names

Occasionally I use Coldfusion’s valuelist() function to generate a comma separated list from a query. The syntax of this function will only allow the function call use a static variable and cannot use a dynamically generated value.

I just found a great tip from Richard Davies’ blog: You can use the array ToList function in place of the valuelist() function which will evaluate correctly at runtime.

arrayToList(queryName.ColumnName)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.