--- title: "Query Wizard - Examples - Lasernet FO Connector User Guide" slug: "query-wizard-examples" description: "The following page contains examples of the features within the Query Wizard. For more information, watch the linked video and read the article." updated: 2025-11-10T11:04:20Z published: 2025-11-10T11:04:20Z canonical: "kb.lasernetgroup.com/query-wizard-examples" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt > Use this file to discover all available pages before exploring further. # Query Wizard - Examples This article provides practical examples and step-by-step instructions on how to use some of the Query Wizard features. ## Copy/Move ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-0D3WPD5L.png) Scenario: The **SalesTable** table must be added to the Sales Confirmation query. The **SalesTable** table must be located between the **CustConfirmJour** and **DlvMode** tables. You can simply add **SalesTable** to **CustConfirmJour**. However, this would result in a structure where child tables are at the same level as the parent table, which could cause issues with joins and ranges. A better approach is to have a nested structure. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-ALVN6N1P.png) Click the **DlvMode** table and move it by using the **Copy/Move** button. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-2DX85G12.png) ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-1UWBON8C.png) ## Group By Note The **Group by** function enables users to group and calculate information, such as the quantity across a combination of products, colors, sizes, and time periods. Performance is improved when this functionality is used in the Query Wizard, as there is no need for XML transformation within Lasernet Developer; the structure is already prepared, and everything is grouped and calculated, along with proper formatting. To enable the **Group by** function, follow these steps: - Navigate to **Lasernet** > **Reports** and select your query report. - Open the **Query Wizard** and select **Next** to navigate to the **Tables** form. - Select the query or subquery you would like to use **Group by** on, expand the **PROPERTIES** menu, and select **Yes** for the **Group by** field. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-86039WK2.png) When you enable the **Group by** function on a query, each field in your query or subquery will require a **Group by** function. Ensure you remove the **RecId** fields from your tables when using **Group by**. This is because using **Group by** on the **RecId** will cause the Connector to create a new group for every **RecId** it encounters in the data. Since **RecId**s are meant to be unique, you will get every line returned, and grouping will not occur properly. #### Group by Function The following custom query will return information on inventory transactions in the system, including their corresponding inventory dimensions (such as color and size), and their display order. The **Group by** function is applied to the following fields: - **InventTrans.ItemId** - **InventDim.InventColorId** - **InventDim.InventSizeId** - **EcoResSize.DisplayOrder** ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-93T8572E.png) The detail records for the **InventTrans** table will be grouped for each unique combination of the **GroupBy** fields: **ItemId**, **InventColorID**, **InventSizeID**, and **DisplayOrder**. In the following example, multiple detail records with **ItemId M0030**, color **White**, size **6**, and display order **106** on the left-hand side are grouped into a single detail record on the right-hand side. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-LNN5CS9N.png) #### Sum Function The **Sum** function is applied to group **InventTrans.Qty**. This calculates the sum of the field **Qty** for each **ItemId** group. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-PLJ4N4YO.png) Using the example where multiple detail records with **ItemId M0030**, color **White**, size **6**, and display order **106** are grouped into a single detail record, the **Qty** fields for the two records on the left-hand side are summed in the **Qty** field on the right-hand side. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-JOW68HOA.png) #### Row Number Function **RowNumber** returns the number of rows within a partition. Row numbering begins with **1** and restarts once **InventDim.InventColorId** changes (the **OVER Partition by** property). The row numbers are ordered by the **OVER order by** field, **InventDim.InventColorId**. This can be used for patterns in Lasernet Developer. The **RowNumber** function is applied to the field **InventDim.InventColorId**. The **InventTrans.ActivityNumber** field is used as a placeholder for the **RowNumber** function. A placeholder field does not return the field value, but the value defined by applying the **Group by** function. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-SWQFPHML.png) **RowNumber** returns the number of rows within a partition. Row numbering begins with **1** and restarts once **InventDim.InventColorId** changes (the **OVER Partition by** property). The row numbers are ordered by the **OVER order by** field, **InventDim.InventColorId**. This can be used for patterns in the Lasernet Developer application. Using the example where a query is using **Group by** and contains two records with the **ItemId M0030** and color **White** (as seen on the left-hand side), the **RowNumber** field provides a row number of **1** to the first record and **2** to the second (as seen on the right-hand side). ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-317PP8D5.png) Note Remember to add sorting fields as grouped fields when using a grouping query.