--- title: "Create dynamic query with the Wizard - Data Quality Studio" slug: "create-dynamic-query-with-the-wizard-general" description: "Learn to set up dynamic queries in your database for data processing, including steps for defining settings, selecting tables, and applying conditions." tags: ["Task topic"] status: "update" updated: 2026-10-05T12:25:59Z published: 2026-10-05T12:25:59Z canonical: "docs.staedean.com/create-dynamic-query-with-the-wizard-general" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Create dynamic query with the Wizard - Data Quality Studio Use a dynamic query to find one or more records in the database. The found records are the input for further processing. You can use a dynamic query on: - An enrichment rule of type **Data query**. - A condition that is applied to a validation rule or duplicate check rule. - A configurable lookup of type **Dynamic query**. You can apply the configurable lookup on a validation rule of type **Configurable lookup**. This topic explains how to set up a dynamic query with the **Query wizard**. You can also start the dynamic query wizard from an existing query to edit it: click **Modify using wizard**. > [!NOTE] > Note > > A dynamic query can be used in multiple data quality policies. Therefore, changes may impact other data quality policies. > > To review the dependencies and assess the potential effect, first check where the dynamic query is used: > > 1. On the **Queries** page, select a query. > 2. On the **Action Pane**, click **Where used**. > 3. Review the dependencies. > > If the desired changes have an unintended impact on other configurations, you can create a copy of the dynamic query: > > 1. On the **Queries** page, select a query. > 2. On the **Action Pane**, click **Copy**. > 3. On the dialog, enter a new name and click **OK**. > 4. Make the changes to the copy. ### Steps 1. Click **Data quality management**. 2. Click **Queries**. 3. Click **New**. 4. Click **New query using wizard**. 5. Sub-task: Define the basic settings for the query. 1. In the **Query** field, type a value. 2. In the **Description** field, type a value. 3. Define the maximum number of records that you want to show in the previews, as a result of the query. In the **Number of records to show in preview** field, enter a number. 4. You can have the query only get the first record that is found by the query. This overrules the setting of the '**Number of records to show in preview**' field. Select **Yes** in the **Select only first record** field. 5. You can have defaults values shown in previews. Select **Yes** in the **Use default value in preview** field. 6. Select whether to run the dynamic query across all companies defined in the current environment (**Yes**) or only in the current company (**No**). Select **Yes** in the **Allow cross company** field. 7. Click **Next**. 6. Sub-task: Select the applicable tables for the query. 1. The root table of the query always must be at the top of the list of selected tables. To make sure this is the case, you are advised to first select and add the root table. Then you can select and add other required tables in one go. In the **Select the query tables pane**, select the root table for the query > [!NOTE] > Note > > You can use filter options to find the desired table. 2. Click **>.** 3. In the **Select the query tables** pane, select the other tables to be added to the query. > [!NOTE] > Note > > You can select and add several tables in one go. 4. Click **>.** 5. Except for the root table, for all tables you must define the parent table. In the right pane, in the list, find and select the desired record. > [!NOTE] > Note > > The table hierarchy for the query must reflect the table hierarchy in the database. Click **Table structure**, to view the table relations for a selected table. 6. In the **Parent** field, enter or select a value. > [!NOTE] > Note > > You can only select a table as parent if it is also in the table selection of the query. 7. Click **Next**. 7. Sub-task: Review or add table relations. 1. You can review the table relations for any child table. If a relation already exists between a parent table and a child table, this relation is automatically loaded and shown. In the left pane, find and select the desired child table. 2. Click **Add**. 3. In the **Child field** field, enter or select a field from the child table. 4. In the **Parent field** field, enter or select the related field from the parent table. > [!NOTE] > Note > > For each relation, you can define the relation settings: **Query fetch mode**, **JOIN type**, **Level**. 5. Click **Next**. 8. Sub-task: Select the fields to be shown for the query. 1. In the left pane, find and select the desired table. 2. In the **Select query fields** pane, find and select the desired fields to be added to the query. 3. Click **>.** > [!NOTE] > Note > > You can use the **Up** and **Down** buttons to arrange the fields in the desired sequence. 4. You can define by which field the query results are grouped. Select the **Group by** check box. 5. You can define an aggregate function to group together the values of several records into one record. Make sure, that you group the records by the right fields in the right order. If you define an aggregate, automatically, '**Group by**' is selected for several fields. Check if this is the selection you need. In the **Aggregate** field, select an option. 6. To review the query results in the preview, click **Refresh**. 7. Click **Next**. 9. Sub-task: Define ranges for the query. 1. You can use a query range to limit the query results to the applicable records only. In the left pane, find and select the desired table. 2. In the middle pane, find and select the fields for which you want to add a range. 3. Click **>.** 4. For each added field, set the relevant condition. In the **Condition type** field, select an option. 5. For each added field, set the value for the condition. To set the value, you can use a fixed value, a function, or sometimes a built-in function. In the **Value** field, enter or select a value. > [!NOTE] > Note > > - For fields of type **String** or **Date**, some functions are already available as built-in function. For these fields, the **Built-in functions** tab is shown on the dialog. You can use these built-in functions to fill in the value of a condition. > - If you use a (built-in) function, the function results are not shown in the preview. To show a value in the preview, fill in the **Preview default value** field. 6. If an empty value is returned, the condition is skipped in the query. However, you can include the 'empty' condition in the query. For example, if for a date field, no date is defined, you can include the 'empty' date condition in the query. Select the **Apply null range values** check box. 7. If you use, in the **Value** field, a: In the **Preview default value** field, type a value. - Fixed value, this value is the default value of the **Preview default value** field. You can change this value. - (Built-in) function, to show a value in the preview, fill in the **Preview default value** field. 8. To review the query results in the preview, click **Refresh**. 10. Click **Finish**. 11. Close the page. ## Related - [Set up dynamic queries - Data Quality Studio](/set-up-dynamic-queries-general.md)