query.each()

call the given UDF/Closure with every row (struct) in the query.

query.each( closure=function, parallel=boolean, maxThreads=number )

Returns: Query

Argument Description
closure
function, required

UDF/Closure that call with the entries from the query

Alias: function, callback, udf

parallel
boolean, optional

execute closures parallel

maxThreads
number, optional

maximum number of threads executed, ignored when argument "parallel" is set to false

Examples

qry = queryNew( "id, name","cf_sql_integer, cf_sql_varchar", [ [ 1, "Tricia" ],[ 2, "Sarah" ],[ 3, "Joanna" ]] );
	writeDump(qry);
	testQueryEach='';
	qry.Each(function(struct row,numeric rowNumber,query query){
		testQueryEach&=row.id&":"&row.name&":"&rowNumber&';';
	});
	writeDump(testQueryEach);

See also