.executeQuery()

Previous Next

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.

Syntax

.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 }

Options is a struct that can contain the following items, all of which are 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. 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() {

  ...

});