Skip to main content
Version: 11.2

Rowset.executeQuery()

note

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

Rowset.executeQuery()

Executes a query specifically for this row set. Existing queried data (if any) is cleared before the query is executed.

Returns a UdbPromise object with the UdbRowSets object as parameter.

Syntax

$.udb( *ds* ).rowSet( *rowSet* ).executeQuery( [options] )
.then( ( *row-set* ) => {
// success
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});

*options* ::= {
[hostvars]: *hostvars*,
[nocheck]: *no-check*,
[orderBy]: *order-by*,
[before]: *before-function*
}

*hostvars* ::= { *name* : *value*, ... }
*no-check* ::= { true | [false] }
*order-by* ::= Array[*order-col*]
*order-col* ::= { *column-name* | *column-sort-order* }
*col-sort-order* ::= { *column-name* : *sort-order* }
*sort-order* ::= { ['ASC'] | 'DESC' }

The required ds parameter is a data source selector.

The required rowSet parameter is a rowset identifier. The query is automatically scoped to this row set's own keys string.

Options is a struct that can contain the following items, all of which are optional.

The optional hostvars is a set of (temporary) name-value pairs that are passed to the query as variables. By default, hostvars is the empty set {}.

No-check is a boolean that specifies whether unhandled manipulations are checked first before the query is executed. This happens only if nocheck is set to false. By default, no-check is false.

Order-by is an array of instructions that determine how the queried data is sorted. Each element in this array is either a column name or a struct combining a column name with an 'ASC' or 'DESC' instruction, as in the Example below. Column names not accompanied by 'DESC' automatically result in sorting in ascending order ('ASC' is the default). If you specify order-by, any existing default sort order settings defined in Web Designer are overwritten.

Before-function is a function that is executed before the query is performed.

Example

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

rowSet.executeQuery({ hostvars: { 'ID': '5' } }).then(() => {
console.log('%d record(s) queried', rowSet.rowCount());
});
EventApplies toOccurs when
beforeexecutequeryData source objectsBefore the data source is queried
showdataData source objectsNew data is available for display.