$.udb(ds).executeQuery()

  • 1 August 2022
  • 0 replies
  • 217 views

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

$.udb(ds).executeQuery()

Executes a query. Existing queried data (if any) is cleared before the query is executed. The data that is retrieved by the query is always the first data set of the data source, which has its boundaries defined by the dataSetSize() function of the DataSourceMetaContainer object.

Returns a Promise object or the 'this' object. From USoft 10.0.1I, returns a udbPromise instead of a Promise object.

Syntax

$.udb( ds ).executeQuery( options )

options ::= {
hostvars: hostvars,
nocheck: nocheck,
orderBy: order-by,
before: before-function,
promise: promise,
success: success-function,
error: error-function
}

hostvars ::= { name : value, ... }

nocheck ::= { true | false }

order-by ::= order-col, ...
order-col ::= { col-name | col-sort-order }
col-sort-order ::= { col-name : sort-order }
sort-order ::= { ASC | DESC }

promise ::= { true | false }

The optional ds is a data source selector.

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.

Nocheck 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, nocheck 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' are automatically result in sorting in ascending order (‘ASC’ is the default). If you specify order-by, any existing sort order settings defined in Web Designer are overwritten.

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

Promise determines the return value of this function. If promise has the value 'true' (the default), a Promise object is returned. If promise has the value 'false', the ‘this’ object is returned instead.

Success-function is a function that is executed after the query is executed and the data is processes successfully on the client.

Error-function is a function that is executed if the query fails.

Example

$.udb('EMP').executeQuery({
hostvars: { 'ID' : '5' },
orderBy: ['NAME', {DEPT: 'DESC'}]
}).then(function() {
...
});

Related events

Event Applies to Occurs when
beforeexecutequery Data source objects Before the data source is queried

 


0 replies

Be the first to reply!

Reply