Language proposal: cfquery returnType="arrayOfArrays/array_of_arrays"

Array of structs is my normal go-to, but when creating structured data outputs for vendors it would be wonderful to do this:

models.each((row)=>{ echo("#row.toList()#") })

instead of this:

models.each((row)=>{ echo("#row.model_manager_firm#,#row.model_name#,#row.units#,#row.ticker#,#row.cusip#,#row.weight#,#row.defer#,#row.substituteTicker#,#row.substituteCusip#") })
echo( row.valueArray().toList() );

Is that what you need?

(please, for proposals you should use the “language” or “proposals” tags. Many thanks)

valueArray() returns a column, not a row, but good thought. I hoped rowData() would return an array, since the default is a struct, but no luck.

I think you need to translate the row (that is a struct) to an array of values first, so you can toList().

models.each( (row) => { echo( structValueArray( row ).toList() );} );

But watch out… depending on what you are doing with that list, as soon as your values have a delimiter, it will break your data separation. Also, you may need to order your struct for an ordered output.

1 Like