Maps each query row using a function to manipulate the rows fields
queryMap(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
→ returns query
query.map(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
row
*
struct
:
A struct with all of the columns for the current iteration
currentRow
*
numeric
:
The value for the current iteration
query
*
query
:
A reference of the original struct
false
true
false
20
Manipulates query column
news = queryNew("id,title",
"integer,varchar", [{
"id": 1,
"title": "Dewey defeats Truman"
}, {
"id": 2,
"title": "Man walks on Moon"
}]
);
writeDump(news);
function mapQuery(any Obj) {
if (Obj.id == 1)
Obj.title = "NEW: " & Obj.title;
return Obj;
}
newQuery = QueryMap(news, mapQuery);
writeDump(newQuery);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.