Filters query rows specified in filter criteria
queryFilter(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
→ returns query
query.filter(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
row
*
struct
:
A struct with all of the columns for the current iteration
currentRow
*
numeric
:
The row number for the current iteration
query
*
query
:
A reference of the original query
false
true
false
20
news = queryNew("id,type,title", "integer,varchar,varchar");
queryAddRow(news,[{
id: 1,
type: "book",
title: "Cloud Atlas"
},{
id: 2,
type: "book",
title: "Lord of The Rings"
},{
id: 3,
type: "film",
title: "Men in Black"
}]);
books = queryFilter(news,function(_news) {
return _news.type is 'book';
});
writeDump(valueList(books.title,', '));
Expected Result: Cloud Atlas, Lord of The Rings
news = queryNew("id,type,title", "integer,varchar,varchar");
queryAddRow(news,[{
id: 1,
type: "book",
title: "Cloud Atlas"
},{
id: 2,
type: "book",
title: "Lord of The Rings"
},{
id: 3,
type: "film",
title: "Men in Black"
}]);
books = news.filter(function(_news) {
return _news.type is 'book';
});
writeDump(valueList(books.title,', '));
Expected Result: Cloud Atlas, Lord of The Rings
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.