--- title: "Create query" slug: "create-query" description: "Learn to configure queries in Anywhere Mobility design, set record limits, and manage table relations for effective data retrieval in your applications." tags: ["Task", "Anywhere Mobility Studio"] updated: 2026-03-20T12:50:21Z published: 2026-03-20T17:46:51Z canonical: "docs.staedean.com/create-query" --- > ## 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 query You can use a query to get the relevant data: - To be shown in a configurable grid. - For the predefined '**Query**' action that is used on an event procedure. - For a counter. To configure a query, you can use the Create query wizard. ### Steps 1. Click **Mobility design**. 2. Click **Create query**. 3. Sub-task: Define the basic settings for the query. 1. In the **Query field**, type a value. 2. Assign the query to an application. In the **Application** field, enter or select a value. 3. Define the maximum number of records that you want to show in the **Mobility studio 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. Define where the query gets the records from. If **No**, the query only gets records from the current company. If **Yes**, the query gets records from all companies. Select **Yes** in the **Allow cross company** field. 6. Click **Next**. 4. Sub-task: Select the applicable tables for the query. 1. In the **Tables** pane, select the tables to be added to the query. > [!NOTE] > **Note** > > You can select and add several tables in one go. 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. 2. Click **>**. 3. Except for the root table, for all tables you must define the parent table. 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. 4. Click **Next**. 5. 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. You can add a table relation to any child table. 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**. 6. 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**. 7. 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** field, select an option. 5. For each added field, set the value for the condition. To set the value, you can use a variable, a function, or a fixed value. In the **Value** field, enter or select a value. > [!NOTE] > **Note** > > You can only use variables and functions that are applicable for the application to which the query is assigned. 6. To review the query results in the preview, click **Refresh**. 8. Click **Finish**. > [!NOTE] > **Notes** > > A query is application specific. You can view the available application queries in several ways, for example on the **Queries** tab of the Mobility design workspace. ## Related - [Set up counters](/set-up-counters.md)