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

Syntax

.executeQuery( options )

 

options  :=  {

     hostvars:  hostvars

,    async:  async

,    nocheck:  nocheck

,    orderBy:  order-by

,    before:  before-function

,    success:  success-function

,    error:  error-function

}

 

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

 

async           :=  { true | false }

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 }

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.

Async is a boolean that specifies whether the query is to be executed asynchronously. Default is true.

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

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.

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( {

 async: true,

 hostvars: { 'ID' : '5' },

 orderBy: ['NAME', {DEPT: 'DESC'}]

} );