Query
Query objects are the javascript variables generated for every Query created under a datasource

Run

Each query object contains a run function that is used to execute the query. The run function is asynchronous by nature and can be chained using the callbacks in the function signature.

Signature

1
run(onSuccess: Function, onError: Function, params: Object): void
Copied!

Arguments

Argument Name
Description
onSuccess
The function to be executed when the run method succeeds
onError
The function to be executed when the run method fails
params
The additional params to be passed to the run method

Passing Params to Run

Most Queries read values directly from entities as global variables. In some cases such as running a query inside a loop, parameters may need to be passed to the query with values contextual to the execution. This can be achieved using the params argument of the run signature. Params sent to a query can be accessed using the this keyword
1
{{ this.params.key }}
Copied!

onSuccess

The onSuccess Function is run when a query is run successfully. The function returns the response of the query and the params passed to it in the callback arguments.
1
onSuccess(response, params): void
Copied!

onError

The onError Function is run when a query execution fails. The function returns the response of the query and the params passed to it.
1
onError(response, params): void
Copied!

Data

Each query stores the data from its latest run inside its data property. This property is populated only if the query successfully executes and can be accessed as
1
{{ Query1.data }}
Copied!
The data type of this property depends on the data
Last modified 30d ago