Whatever message this page gives is out now! Go check it out!

QuerySome

Last update:
May 18, 2026
Note:
You can also set the maximum thread count in ColdFusion Administrator. Click Server Settings > Settings and specify the number of threads in Default Maximum Thread Count For Parallel Functions.

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, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreadCount])
Member function
queryObj.Some(closure)

History

ColdFusion (2021 release): Introduced the following parameters:
  • parallel
  • maxThreadCount
New in ColdFusion (2018 release) Update 5.

Parameters

Parameter
Required/Optional
Description
query
Required
Query in which at least one value is to be searched.
closure
Required
Function that encapsulates criteria.
parallel
Optional
True if you want to enable parallel programming.
maxThreadCount
Optional
The number of threads the function can execute. The number of threads must be between 1-50. If the value exceeds 50, there is an exception.

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

Using parallelization

<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("" & QuerySome(myquery,doesPersonExist,true,5)) // Returns True 
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page