Skip to main content
Version: 11.2

Rowset.dataSet()

note

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

Rowset.dataSet()

Gets information about a specific data set in the row set. The subdivision into data sets of a row set depends on the value of the data source's 'Maximum Number of Records' property. You can get this value by calling .dataSetSize().

Returns a UdbDataSet object with static information about this data set. The data set must have been queried already and must exist prior to calling this function, or else the result value is undefined. Whether or not a data set is queried depends on the value of the data source's 'Automatically query next data sets' property, see .isAutoQuery(); manual navigation to a data set (see .gotoDataSet()) also gets it queried.

Syntax

$.udb( *ds* ).rowSet( *rowSet* ).dataSet( *data-set* )

*data-set* ::= { current | first | last | *index* }

The required ds parameter is a data source selector.

The required rowSet parameter is a rowset identifier.

The required data-set is one of the following:

  • One of the literal values listed and explained in the table below, or
  • An index value that is an integer pointing at a specific data set. The index is 1-based: the first data set has index 1, not 0.
ValueMeaning
currentThe data set that is currently selected
firstThe first data set in the row set
lastThe last data set in the row set

The returned UdbDataSet object contains the following fields and functions:

FieldMeaning
dsi()The data set index value of this data set. The index is 1-based: the first item has index 1, not 0.
startThe index value, relative to the row set, of the first record in the data set. NB: this index value is 0-based.
endThe index value, relative to the row set, of the last record in the data set. NB: this index value is 0-based.
isFirst()A boolean stating whether this is the first data set relative to the row set.
isLast()A boolean stating whether this is the last data set relative to the row set.
isEmpty()A boolean stating whether this data set is empty (contains no records).
rowCountObsolete and replaced with total()
total()An integer indicating the total number of records contained by the row set (including inserted/deleted records).
nofRows()An integer indicating the number of records that this data set may hold.
dirty()A boolean that indicates that the data held by this data set is outdated and may need to be refreshed.

Example

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

if (dataSetInfo.total() > 10) {
let rows = rowSet.rows(dataSetInfo.start, dataSetInfo.start + 10);
}