Skip to main content
Version: 11.2

Rowset.each()

note

This article is about the each() function of the Rowset object.

Rowset.each()

Iterates the execution of a function over the matched row sets.

Returns a UdbPromise object.

note

Unlike DataSourceContainer.each(), this function settles all the calls before resolving, even if one or more of them are rejected. Use this if you always want every matched row set to be processed, regardless of whether earlier ones failed.

Syntax

$.udb( *ds* ).rowSet( *rowSet* ).each( *function*( *index*, *row-set* ) )
.then( ( *result* ) => {
// success
});

The required ds parameter is a data source selector.

The required rowSet parameter is a rowset identifier.

The required function is the function that is to be called for each of the matched row sets.

Index is the array index of the row set for which the function is executed. This index is 0-based.

Row-set is the row set itself. Effectively, row-set is the same object as returned to the function call as this.

The result passed to the .then() clause is an array with, for each matched row set, an object describing whether that call was fulfilled or rejected (in the same shape as the standard Promise.allSettled() result).

Example

$.udb(['EMP', 'DEPT']).rowSet('current').each((index, rowSet) => {
return rowSet.executeQuery();
});