Save and Reuse Queries
The Query Library allows you to reuse a query across multiple charts. If you save a query to the library, any user on your charts project can apply the same query on their own charts. Any changes to a query stored in the library impact all charts thar are connected to that query.
Save Aggregation Pipeline Queries
After you apply an aggregation pipeline query to a chart, you can save it to the Query Library. This makes the query available for use on other charts created by you and other users on the same charts project.
To save a query:
In the Query bar for a chart, input a find() query or an aggregation pipeline and click Apply.
To learn more, see Run Aggregation Pipelines on Your Data and Filter Your Data Using the Query Bar.
Enter a name for your query.
The Query title field shows the names of each existing query and the number of charts that use the query. You can enter a new name for your query or select an eisting query name to overwrite the existing query with your new query.
If you enter a new name, you must also click Create <your-query-title> to create a named query in the library.
If you select an existing query from the list, the field is pre-populated with the selected query name. If you save an existing query, all charts connected to that query will inherit the new query text.
Load Saved Queries
To use a previously saved query from the Query Library on a chart, use the Library dropdown to load the saved query. You can access queries saved by any user in the project.
To load saved queries:
Browse the list of saved queries.
In the Load Query pane, the queries are listed in alphabetical order and are case insensitive. For each query, you can see the name of the query, the start of the query, and the number of charts that use the query. Also, you can do the following:
Hover over the tooltip icon to see the query owner and when the query was last modified.
Click x to close the library pane.
To learn more about all other actions that you can perform on the saved queries, see Manage Saved Queries.
Click Load for the query you wish to load in the query bar.
After loading a query, you can run the query against the data in the chart. Also, you can modify or disconnect the query from the library. To learn more, see Modify or Disconnect Saved Queries.
Modify or Disconnect Saved Queries
After you load a saved query, you can modify or disconnect the query from the library.
To modify, make changes to the query in the query bar and save the
query under its original name, only if you created the query or have
the Project Owner
role, or save the query under a new name.
If you save the modified query under the same name, all other charts using the same named query will inherit the modified query for reuse.
If you save the modified query in the library under a new name, the modified query, although unused by other charts initially, will be available for reuse in the future.
To disconnect, modify the query in the query bar and click Apply after changing the query. The query is disconnected from the library, which makes the modified query private to this chart. You must save the query to the library if you wish to reuse this query on other charts in the future. If you save the query under the same name in the library, all charts connected to it will inherit the new query.
Alternatively, click Revert before applying the query to the chart to undo the changes.
Manage Saved Queries
When you load a saved query, the
query author or user with the Project Owner
role can
rename or delete the queries in the library.
Choose Load Query from the dropdown to display the Load Query pane.
In the Load Query pane, the queries are listed in
alphabetical order and are case insensitive. You can do the following
if you created the query or if you have the Project Owner
role:
Rename a Query
Click the pencil icon next to the name of the query that you wish to rename.
Enter the new name for the query. Each query name must be unique.
Click the check mark to save the query under the new name.
Rename or delete the query from the library.
Delete a Query
Click the trash icon for the query you wish to delete from the library.
Choose one of the following options:
Delete the query from the library, and keep the contents of the query on the connected chart.
If you choose this option, the query will continue to be available to any charts that used the query, but the query will be disconnected from the library and unavailable for any new charts.
Delete query from the library, and remove the contents of the query on the connected chart.
If you choose this option, the query will be removed from the library and unavailable for any new or existing charts that used the query.