Bind Parts of a Query

You can dynamically set parts of a query based on the selection or results of another query. For example, you can set the grouping in a query based on the grouping selected in a chart.

Before we discuss how to bind the different parts of the query, let’s look at a comprehensive example. This example illustrates the interactions for different parts of a query. The chart is bound based on selections for grouping, measure, filter, order, and limit. When you make a selection in one of the toggle widgets, the chart changes to show the results of the modified query.

The dashboard shows toggle widgets that dynamically modify the chart's query based on selections of groupings, measures, filters, orders, and limits.

Here’s the JSON for the queries that power this dashboard. The Account_BillingCount_1 query is the underlying query for the chart widget. This query contains multiple interactions based on other queries.

If you bind a measure or grouping in a query used for a chart, you must also replace the columnMap section in the widget-level chart JSON with an empty columns array. For more information, see Measure Interactions and Group Interactions.