Introduction
Theawait
block, along with the runQuery
function lets you manually run queries in a synchronous manner. This is useful when you want to display custom content based on the results of a query.
Basic usage
There are three possible states for theawait
block: pending
, fulfilled
and rejected
. You can use the {:then}
and {:catch}
blocks to handle the fulfilled
and rejected
states respectively.
The Run Query function
TherunQuery
function is a built-in function that lets you run queries synchronously. It takes a query name as an argument and returns the result of the query.
In addition to the query name, this function can have these three attributes:
The path to the query file that will provide the data displayed in the visualization.
An object with custom parameters to be used in the query, in addition to the global parameters of the view.
Includes options to control the behavior of the chart. For example, react to changes in the parameters to update the data immediately.
{:then}
block, will be the data returned by the query. This data is structured as an array of objects, where each object represents a row in the query result. For example: