queryColumnData

Returns the data in a query column. See also valueArray which is supported on ACF 2016+ and Lucee.

queryColumnData(query, columnName [, closure]) → returns array

Member Function Syntax

query.columnData(columnName [, closure])

This function requires Lucee. Not supported on Adobe ColdFusion.

queryColumnData Argument Reference

query
Required

columnName
Required

closure

Examples sample code invoking the queryColumnData function


Create and populate a query and output the 'name' column data as an array

myQuery = QueryNew( '' );
names = [ 'Indra','Elizabeth','Harry','Seth' ];
queryAddColumn( myQuery,'name','varchar',names );
result = queryColumnData( myQuery,'name' );
Dump( var='#result#' );

Using a member function

myQuery = QueryNew( '' );
names = [ 'Indra','Elizabeth','Harry','Seth' ];
queryAddColumn( myQuery,'name','varchar',names );
result = myQuery.columnData( 'name' );
Dump( var='#result#' );

Fork me on GitHub