queryToStruct

Converts a query to a struct, keyed by the values of one column.

queryToStruct(query, columnKey [, structType] [, valueRowNumber]) → returns struct

This function requires Lucee 6.0.0.302 and up.  Not supported on Adobe ColdFusion, etc.

Argument Reference

query query
Required

The query to convert.

columnKey string
Required

The column whose values become the struct keys.

structType string
Default: ordered

The type of struct to create.

valueRowNumber boolean

When true, each value is the row number instead of a struct of the row's data.

Examples
Sample code invoking the queryToStruct function

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub