docs/versioned_docs/version-2.35.0/app-builder/query-panel.md
The Query Panel, located at the bottom of the app-builder, allows you to create and manage queries to interact with connected data sources. It provides the capability to perform API requests, query databases, and apply transformations or data manipulation using JavaScript and Python.
The Query Panel consists of two sections:
The Query Manager on the left lists all the queries that have been created in the application. Query Manager helps in managing the queries that have been created.
<div style={{textAlign: 'center'}}> </div>The + Add button on the Query Manager is used to add new queries in the application. When Add button is clicked, a menu will open with a list of options for creating a query from the available data sources.
On the top of Query Manager, there is button to Sort or Filter queries. The button allows you to select from the following options:
Filter:
Sort:
Next to the filter is the search box that can be used to search for a specific query.
On hovering on a query name, you can see the edit, copy and delete buttons. The edit button lets you rename the query, the delete button lets you delete the selected query, and the duplicate button duplicates the selected query.
</div>Query Editor provides the functionality to construct queries either through a low-code interface or by manually entering the query text.
:::info The changes made in the query panel will be saved automatically. :::
<div style={{textAlign: 'center'}}> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>Apart from the query editor, the query name is displayed at the top of the query panel. Click on it to make edits and customize the query name as needed.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>Custom parameters provide a convenient method for passing variables to a query. To add parameters, simply click the + button next to the Parameters label in the top bar of the query editor.
For each parameter, you need to specify:
Syntax for utilizing the parameter: Employ parameters.<identifier> in your query. It's important to note that parameters can only be utilized within the specific query where they are defined.
Learn more about Using Custom Parameters.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>The Preview button allows you to preview the data returned by the query. The data is displayed in the preview section at the bottom of the query panel, aiding in query debugging without triggering the query in the app.
Data preview is available in two formats: Raw and JSON. Click the clear button to reset the preview data.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>The Run button triggers the query, causing it to interact with the application. This action differs from the Preview feature.
Query Configuration allows you to set vital values that are necessary to generate a response from a database. These configurations may include but are not limited to:
Data source: Name of the data sourceOperation: The kind of operation you want to perform (For e.g., List collections,Find one, Find many,etc.)The set of configuration options you get depend on the type of data source.
<div style={{textAlign: 'center'}}> </div>The primary and default parameter for all queries is data source. This option enables the selection of the appropriate data source for your query.
In cases where multiple data sources of the same type are connected, easily switch the query's data source using the dropdown menu.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>Queries can be enhanced with transformations to modify the query results. ToolJet supports transformations using two programming languages: JavaScript & Python. Refer to the detailed documentation on Transformations for more information.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>Enabling this option executes the query every time the app is loaded.
Enabling this option displays a confirmation modal, prompting for a Yes or No before firing the query.
Enabling this option shows a success toast notification when the query is successfully triggered. Customize the success message and notification duration in milliseconds.
</div> <div style={{paddingTop: '24px', paddingBottom: '24px'}}>Event handlers can be added to queries for the following events:
Event handlers link actions in your application for smoother operation. Here's an example:
Scenario: You have two queries:
The Result:
:::info Learn more about Event Handlers and Actions. :::
<div style={{textAlign: 'center'}}> </div> </div>