QuerySome

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

Parameter

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

 Adobe

Получайте помощь быстрее и проще

Новый пользователь?

Adobe MAX 2024

Adobe MAX
— творческая конференция

С 14 по 16 октября очно в Майами-Бич и онлайн

Adobe MAX

Творческая конференция

С 14 по 16 октября очно в Майами-Бич и онлайн

Adobe MAX 2024

Adobe MAX
— творческая конференция

С 14 по 16 октября очно в Майами-Бич и онлайн

Adobe MAX

Творческая конференция

С 14 по 16 октября очно в Майами-Бич и онлайн