sisense.com
✅ You are viewing documentation for the latest version of Compose SDK.
Version:

Function ExecuteQuery

ExecuteQuery(props): Promise< ReactNode > | ReactNode

Executes a query and renders a function as child component. The child component is passed the state of the query as defined in QueryState.

This component takes the Children Prop Pattern and offers an alternative approach to the useExecuteQuery hook.

Parameters

ParameterTypeDescription
propsExecuteQueryPropsExecuteQuery properties

Returns

Promise< ReactNode > | ReactNode

ExecuteQuery component

Example

Example of using the component to query the Sample ECommerce data source:

<ExecuteQuery
  dataSource={DM.DataSource}
  dimensions={[DM.Commerce.AgeRange]}
  measures={[measureFactory.sum(DM.Commerce.Revenue)]}
  filters={[filterFactory.greaterThan(DM.Commerce.Revenue, 1000)]}
>
{
  ({data, isLoading, isError}) => {
    if (isLoading) {
      return <div>Loading...</div>;
    }
    if (isError) {
      return <div>Error</div>;
    }
    if (data) {
      console.log(data);
      return <div>{`Total Rows: ${data.rows.length}`}</div>;
    }
    return null;
  }
}
</ExecuteQuery>
Last Updated: