Skip to main content
Version: 11.2

Rowset.indexOf()

note

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

Rowset.indexOf()

Gets the index position of a specified target row set, if this target row set exists in the collection of row sets contained in the Rowset object. Use this function also to find out whether a specified row set exists at all.

Returns an integer. The index is 0-based: the first item has index 0, not 1. Returns -1 if the target row set does not exist in the collection.

Syntax

$.udb( *ds* ).rowSet( *rowSet* ).indexOf( *target-row-set*, [data-source] )

The required ds parameter is a data source selector.

The required rowSet parameter is a rowset identifier.

The required target-row-set may be specified using a string (a keys string) or an object (key values).

tip

For details on how to reference a row set, go to UDB Rowset object.

If the collection contains row sets of multiple data sources, the optional data-source may be used to narrow down the search to one specific data source.

Example

let rowSet = $.udb('EMP').rowSet('current');

if (rowSet.indexOf(rowSet.keysString()) === -1) {
console.log('The current row set is no longer part of this Rowset collection');
}