If you want to share a query with others, but limit how they can change the query, you can make it interactive.
Others can then only change the value(s) that are interactive in your query β not the query itself.
π€ Who can do this? The owner of the query, or anyone with edit access to the query can make it interactive. Once interactive, anyone with read-only access to the query can also edit only the interactive part.
SQL queries
To make a SQL query interactive:
- Open the query in Insights.
- Highlight the value you want to be interactive.
- On the bar separating the query from the results, click the curly braces icon and then click the Add variable button.
- Click the settings icon to the right of the Enter a string text box to define the custom variable:
- For Name, enter a meaningful name for the custom variable.
- For Type, change the data type of the custom variable, if necessary.
- For Default value, enter the value to use for the custom variable if other users do not change it.
- At the bottom of the Edit dialog for the custom variable, click Save.
- In the upper right of the query editor, click Run to confirm the query still operates as expected.
That's it, your query is now interactive! π
πͺ Did you know? You can select from a wide range of data types for your custom variables β string, number, date, date and timestamp ranges, and multi-value options.
VQB queries
To make a Visual Query Builder (VQB) query interactive:
- Open the query in Insights.
- Find the value you want to be interactive.
- In the right of the box for that value, click the lightning bolt icon.
- In the upper right of the query editor, click Run to confirm the query still operates as expected.
That's it, your query is now interactive! π