This function calls a given closure/function with every element in a given query and returns true, if one of the closure calls returns true
querySome(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
→ returns boolean
query.some(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads])
row
*
struct
:
A struct with all of the columns for the current iteration
currentRow
*
numeric
:
The value for the current iteration
query
*
query
:
A reference of the original struct
false
true
false
20
Here,we've example to check whether the 75 is exists or not in myquery mark column value.
<cfscript>
var myQuery = queryNew("id,name,mark","integer,varchar,integer",[[1,"Rahu",75],[2,"Ravi",80]]);
result = querySome(myQuery , function(details){
return details.mark IS 75;
});
writeOutput((result ? "Some" : "No") & " matches Record found!");
</cfscript>
Expected Result: Some matches Record found!
Here,we've example to check whether the 85 is exists or not in myquery mark column value using query member function.
<cfscript>
var myQuery = queryNew("id,name,mark","integer,varchar,integer",[[1,"Rahu",75],[2,"Ravi",80]]);
result = myQuery.Some(function(details){
return details.mark IS 85;
});
writeOutput((result ? "Some" : "No") & " matches Record found!");
</cfscript>
Expected Result: No matches Record found!
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.