Parameter
Last updated on
May 18, 2021
Description
Determines if at least one value in a query satisfies a specified condition.
Returns
True if at least one value matches a condition; false, otherwise.
Syntax
QuerySome(query,closure)
Member function
queryObj.Some(closure)
History
New in ColdFusion (2018 release) Update 5.
Parameters
|
Required/Optional |
Description |
---|---|---|
query |
Required |
Query in which at least one value is to be searched. |
closure |
Required |
Function that encapsulates criteria . |
Example
<cfscript> myQuery=queryNew([ {"Id":101,"Name":"John"}, {"Id":102,"Name":"Jason"}, {"Id":103,"Name":"Jack"}, {"Id":104,"Name":"James"} ]); // First closure to check for Jim doesPersonExist=(obj)=>return obj.name=="Jim" writeOutput(QuerySome(myquery,doesPersonExist)) // Returns False // Second closure to check for James doesPersonExist=(obj)=>return obj.name=="James" writeOutput("<br/>" & QuerySome(myquery,doesPersonExist)) // Returns True </cfscript>
Output
NO
YES