Rows.each()
This article is about the each() function of the Rows object.
Rows.each()
Iterates the execution of a function for each row contained in the Rows object.
Returns a Promise object or the 'this' object. From USoft 10.0.1I, returns a udbPromise instead of a Promise object.
Syntax
*rows*.each( *function* ( *index*, *row* ), *promise* )
promise ::= { true \| false }
The required function is the function to be executed.
The optional index is the index key of the item in the rowset collection for which the function is executed.
The index is 0-based: the first item has index 0, not 1.
The optional row is the row itself. Effectively, this is the same object as returned by 'this'.
If the optional promise has the value of 'true' (the default), a Promise object is returned. The .then()
clause for this Promise is executed once all Promises created by the function passed to .each()
have been settled. If promise has the value of 'false', the ‘this’ object (the row sets collection) is returned instead.
Example
$.udb('EMP').rows().each(function(index, r){
alert(r.cols('EMP_NO').val());
});