bdw429s
05/25/2022, 12:21 AMqueryColumnData()
function has a closure
argument. I never had. The argument shows in cfdocs.org/querycolumndata, but with no explanation at all. The docs.lucee.org/reference/functions/querycolumndata.html#argument-closure page simply says
UDF/Closure that call with the values from columnwhich is a little vague. Some testing appears to show that this closure can be used map the array by returning a different value which overrides the value taken from the column. For instance, this would upper case all the values from this column in the final array
myQuery
.columnData( 'name', (data)=>data.ucase() );
but I'm really wondering why this exists. CFML already has a construct called arrayMap()
which seems sufficient if I want to massage all the values of an array
myQuery
.columnData( 'name' )
.map( (data)=>data.ucase() );
I'm just not clear why queryColumnData()
needed this as there's certainly no precedent set that any BIF that returns an array also has an inbuilt closure argument for also mapping that array.Scott Steinbeck
05/25/2022, 5:33 AMScott Steinbeck
05/25/2022, 5:41 AMzackster
05/25/2022, 8:53 AMpothys-mitrahsoft
05/25/2022, 9:45 AMAdam Cameron
map
for that.Adam Cameron
queryColumnData
, so it's not possible to see how the requirements for it were fleshed out.
Or does LAS have some other internal issue tracker that covers all this?zackster
05/25/2022, 10:07 AMzackster
05/25/2022, 10:07 AMpothys-mitrahsoft
05/25/2022, 10:41 AMAdam Cameron
But the queryColumnData() were already implemented in 2012 before the arrayMapAh! That makes sense then. Cheers for the clarification. I still stick with my suggestion of doing the deprecation, and pointing ppl to
arrayMap
instead. But as far as suggestions go, it's not worth anyone losing any sleep over.Adam Cameron
bdw429s
05/25/2022, 2:45 PM