collectionFilter

Filters items from a collection passing the filter condition

collectionFilter(collection, filter [, parallel] [, maxThreads]) → returns any

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

Argument Reference

collection any
Required

filter function
Required

parallel boolean

maxThreads numeric
Default: 20

Examples
Sample code invoking the collectionFilter function

coll = [{
    id: 0,
    type: 'mail'
},{
    id: 1,
    type: 'mail'
},{
    id: 2,
    type: 'comment'
}];
onlyMails = collectionFilter(coll,function(item) {
    return item.type is 'mail';
});
for(mail in onlyMails) {
    writeOutput(mail.id&', ');
}

Expected Result: 0, 1,

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

Fork me on GitHub