**Source URL:** https://general.veevavault.dev/medical/vault-toolbox/intellij-plugin/guides/vql-console.md

# Using the VQL Console

The Vault Toolbox plugin includes a VQL Console for running read-only Vault queries directly within IntelliJ IDEA. This guide outlines how to write and run queries in the console and build queries visually with the Query Builder. Learn more about [sending VQL queries](/vql/getting-started/structuring-sending-queries).

<Aside>VQL is read-only and cannot modify data. Your user account must have the appropriate object and field permissions to query records.</Aside>

## Running Queries {#running-queries}

The VQL Console features syntax highlighting, object and field auto-completion, paginated results, CSV export, and persistent query history.

To run a query:

<Steps>
1. Within IntelliJ IDEA, open the Vault Toolbox plugin from the righthand sidebar.

2. Select the **VQL Console** (<Icon name="ph:terminal-window"></Icon>) tab.

3. Type a VQL statement in the editor or select an existing query from the **History** dropdown. As you type, object and field names auto-complete.

4. Optional: Click <Icon name="ph:brackets-curly"></Icon> within the editor to format the query for readability.

5. Click <Icon name="ph:terminal-window"></Icon> **Run** to execute the query. Alternatively, press `Cmd+Enter` (macOS) or `Ctrl+Enter` (Windows/Linux). To run only a portion of the query, select the text, then click <Icon name="ph:terminal-window"></Icon> **Run**.

6. Optional: While a query is running, click <Icon name="ph:x"></Icon> **Cancel** to stop it.

</Steps>
<ThemeImage srcLight="/images/toolbox/intellij-plugin/vql_console_light.png" srcDark="/images/toolbox/intellij-plugin/vql_console_dark.png" alt="IntelliJ Plugin VQL Console"></ThemeImage>
Results display in a grid below the editor. To page through results, click **◀ Prev** or **Next ▶** at the bottom of the results panel. The status bar shows the row count and elapsed time. Vault Toolbox retains the last 25 queries in the **History** dropdown across IDE sessions.

### Editing Results {#editing-results}

Double-click on a cell in the results grid to edit its value. Click <Icon name="ph:upload"></Icon> **Save Changes** to deploy these changes to Vault.

### Exporting Results {#exporting-results}

To export the current page of results to a CSV file in your project directory, click <Icon name="ph:download"></Icon> **Export CSV**.

### Revealing Query Targets {#revealing-query-targets}

To reveal the object the query is targeting in the [Schema Explorer](/vault-toolbox/intellij-plugin/guides/schema-explorer), click <Icon name="ph:stack"></Icon> **Schema**. Select an object or field name in the editor first to reveal that specific item, or include a `FROM` clause to reveal the object it names.

## Building Queries Visually {#building-queries-visually}

The Query Builder helps you construct a VQL statement without writing it by hand. Pick an object, choose which fields to select, add filter conditions, and optionally order the results — the dialog displays a live preview of the resulting VQL.

To build a query visually:

<Steps>
1. From the VQL Console, click <Icon name="ph:hammer"></Icon> **Build Query**.

2. In the dialog, select an object from the **Object** dropdown.<ThemeImage srcLight="/images/toolbox/intellij-plugin/query_builder_light.png" srcDark="/images/toolbox/intellij-plugin/query_builder_dark.png" alt="IntelliJ Plugin Query Builder"></ThemeImage>

3. In the **Fields to select** list, select the checkbox for each field to include. Select **Select all** to include every field, or **Include related fields** to surface fields available through relationships.

4. Optional: Under *Filters*, click <Icon name="ph:plus"></Icon> to add a filter row. Select a **Field**, an **Operator** (`=`, `!=`, `<`, `>`, `<=`, `>=`, `LIKE`, `IN`, `IS NULL`, `IS NOT NULL`), and provide a **Value**. Use the **And/Or** column to combine multiple conditions.

5. Optional: Under **Order By**, select a field and a direction: `ASC` or `DESC`.

6. Review the live VQL preview at the bottom of the dialog, then click **OK** to insert the query into the console editor.

</Steps>
The generated query does not run automatically. Review and edit it in the console, then click <Icon name="ph:terminal-window"></Icon> **Run** to send the query.



---

**Previous:** [Designing & Deploying Custom VPKs](/medical/vault-toolbox/intellij-plugin/guides/designing-deploying-custom-vpks)  
**Next:** [Using the Schema Explorer](/medical/vault-toolbox/intellij-plugin/guides/schema-explorer)