queryFilter

Filters query rows specified in filter criteria

queryFilter(query, filter [, parallel] [, maxThreads]) → returns query

Member Function Syntax

query.filter(filter [, parallel] [, maxThreads])

queryFilter Argument Reference

query query
Required

filter function
Required

parallel boolean

Lucee 4.5+

maxThreads numeric
Default: 20

Lucee 4.5+

Compatibility

ColdFusion:

Version 2016+ ColdFusion only supports query and filter param, also QueryFilter mutates the original query (bug report: https://tracker.adobe.com/#/view/CF-4203366)

Links more information about queryFilter

Examples sample code invoking the queryFilter function

<cfscript>
    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,', '));
</cfscript>

Expected Result: Cloud Atlas, Lord of The Rings

<cfscript>
    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,', '));
</cfscript>

Expected Result: Cloud Atlas, Lord of The Rings


Fork me on GitHub