--- title: "Aggregate Operator: Count By Using Group Key" slug: "aggregate-operator-count-by-using-group-key" updated: 2025-09-25T21:04:25Z published: 2025-09-25T21:04:25Z canonical: "docs.unqork.io/aggregate-operator-count-by-using-group-key" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.unqork.io/llms.txt > Use this file to discover all available pages before exploring further. # Aggregate Operator: Count By Using Group Key UDesignerClassic Designer ## Overview The **Aggregate operator** is used to count the number of entries in a data set. You can also use the operator’s **Group Key** field, which lets you to group the results into categories based on values from the original data. For example, consider a [Data Table](/v1/docs/data-table-component) component that stores the details of several dogs and their favorite foods. You'll configure a [Data Workflow](/v1/docs/data-workflow-component) component to count how many dogs have the same favorite food. In this example , each type of food displays as a separate category using the **Group Key** field. ## Configuration ### Configure the Data Table Component First, you'll add a [Data Table](/v1/docs/data-table-component) component to store a list of dogs and favorite foods that your [Data Workflow](/v1/docs/data-workflow-component) component can retrieve. 1. In the Module Builder, drag and drop a **D****ata Table** component onto your canvas. 2. In the Property ID field, enter `dtDogs`. 3. In the data table, enter the following: | | A | B | | --- | --- | --- | | 1 | name | favoriteFood | | 2 | Ivy | Peanut Butter | | 3 | Lucy | Beef Jerky | | 4 | Wally | Peanut Butter | | 5 | Nacho | Peanut Butter | | 6 | Thor | Salmon | | 7 | Holly | All Foods | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Data_table_Favorite_food_thumb_0_0.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) 4. Click **Save Component**. ### Configure the Data Workflow Component Next, you'll add your Data Workflow component and bring your data into the Data Workflow using an Input operator. Then, you'll add an Aggregate operator to count how many dogs have the same favorite food. But to get an accurate count, you must count the names associated with each favorite food. So, you'll set the Aggregate operator to use the **Value Key** of name and **Group Key** of favoriteFood. Lastly, you'll view the result using a Console operator and the DevTools Console. 1. Drag and drop a **D****ata Workflow** component onto your canvas, placing it below your **dtDogs** **D****ata Table** component. 2. In the Property ID and Canvas Label Text fields, enter `dwfFavoriteFood`. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Data_Workflow_Favourite_Food_thumb_0_0.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) #### Configure the Input Operator 1. Drag and drop an **I****nput** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Info | | --- | | Category | Input | | Component | dtDogs | | Required | Yes | | Source | Default | #### Configure the Aggregate Operator 1. Drag and drop an **A****ggregate** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Info | | --- | | Setting | Value | | Category | Aggregate By | | Label | Favorite Food Counts | | Aggregation Type | Count By | | Join Group Keys | Yes | | Group Key | favoriteFood | | Value Key | name | 3. Connect the output port (right) of the **dtDogs** **I****nput** operator to the input port (left) of the **Favorite Food Counts** **A****ggregate** operator. #### Configure the Console Operator 1. Drag and drop a **C****onsole** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Info | | --- | | Category | Console | | Label | How many dogs have the same favorite food? | 3. Connect the output port (right) of the **Favorite Food Counts** **A****ggregate** operator to the input port (left) of the **How many dogs have the same food?** **C****onsole** operator. 4. Click **Save Component**. ### Configure the Button Component Now, you'll add a [Button](/v1/docs/button-component) component to trigger the Data Workflow. Clicking the button executes the Data Workflow and counts the number of dogs who have the same favorite food. 1. Drag and drop a ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/button_component_icon(33).png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) **Button** component onto your canvas, placing it below the **D****ata Workflow** component. 2. In the Property ID, enter **btnFavoriteFood**. 3. In the Label Text, enter `Count Favorite Foods`. 4. From the **Action Type** drop-down, select **Event**. 5. From the **On Click** drop-down, select **dwfFavoriteFood**. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Button_favorite_foods_thumb_0_0.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) 6. Click **Save Component**. 7. **Save** your module. Here's how your module looks in the Module Builder: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/A0604001B-Aggregate_Operator__thumb_0_0.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) **Preview** your module in Express View and open the DevTools Console. Click the button to view the list of each favorite food for the dog type. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Favorite_dog_food_Console_thumb_0_0.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) ## Overview The **Aggregate operator** is used to count the number of entries in a data set. You can also use the operator’s **Group Key** field, which lets you to group the results into categories based on values from the original data. For example, consider a [Data Table](/v1/docs/data-table-component) component that stores the details of several dogs and their favorite foods. You'll configure a [Data Workflow](/v1/docs/data-workflow-component) component to count how many dogs have the same favorite food. In this example , each type of food displays as a separate category using the **Group Key** field. ## Configuration ### Configure the Data Table Component First, you'll add a [Data Table](/v1/docs/data-table-component) component to store a list of dogs and favorite foods that your [Data Workflow](/v1/docs/data-workflow-component) component can retrieve. 1. Drag and drop a **D****ata Table** component onto your canvas. 2. In the Property ID and Label Text fields, enter `dtDogs`. 3. In the data table, enter the following: | A | B | | --- | --- | | name | favoriteFood | | Ivy | Peanut Butter | | Lucy | Beef Jerky | | Wally | Peanut Butter | | Nacho | Peanut Butter | | Thor | Salmon | | Holly | All Foods | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Dwf_Aggregate_CountBy_DT_thumb_0_0.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) 4. Click **Save & Close**. ### Configure the Data Workflow Component Next, you'll add your Data Workflow component and bring your data into the Data Workflow using an Input operator. Then, you'll add an Aggregate operator to count how many dogs have the same favorite food. But to get an accurate count, you must count the names associated with each favorite food. So, you'll set the Aggregate operator to use the **Value Key** of `name` and **Group Key** of `favoriteFood`. Lastly, you'll view the result using a Console operator and the DevTools Console. 1. Drag and drop a **D****ata Workflow** component onto your canvas, placing it below your **D****ata Table** component. 2. In the Canvas Label Text and Property ID fields, enter `dwfFavoriteFood`. #### Configure the Input Operator 1. Drag and drop an **I****nput** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Input | | Component | dtDogs | | Required | Yes | | Source | Default | #### Configure the Aggregate Operator 1. Drag and drop an **A****ggregate** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Aggregate By | | Label | Favorite Food Counts | | Aggregation Type | Count By | | Join Group Keys | Yes | | Group Key | favoriteFood | | Value Key | name | 3. Connect the output port (right) of the **dtDogs** **I****nput** operator to the input port (left) of the **Favorite Food Counts** **A****ggregate** operator. #### Configure the Console Operator 1. Drag and drop a **C****onsole** operator onto your **D****ata Workflow** canvas. 2. Configure the operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Console | | Label | How many dogs have the same favorite food? | 3. Connect the output port (right) of the **Favorite Food Counts** **A****ggregate** operator to the input port (left) of the **How many dogs have the same food?** **C****onsole** operator. Here's how the completed workflow looks: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/DWF_Aggregate_CountBy_Dwf_thumb_0_0.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) 1. Click **Save**. ### Configure the Button Component Now, you'll add a [Button](/v1/docs/button-component) component to trigger the Data Workflow. Clicking the button executes the Data Workflow and counts the number of dogs who have the same favorite food. 1. Drag and drop a ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/button_component_icon(34).png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) **Button** component onto your canvas, placing it below the **D****ata Workflow** component. 2. In the Property ID, enter **btnFavoriteFood**. 3. In the Label Text, enter `Count Favorite Foods`. 4. From the **Action Type** drop-down, select **Event**. 5. From the **Trigger on Click** drop-down, select **dwfFavoriteFood**. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Dwf_Aggregate_CountBy_Btn_thumb_0_0.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) 6. Click **Save**. 7. **Save** your module. Here's how your module looks in the [Module Builder](/v1/docs/introduction-to-the-module-builder): ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/DWF_Aggregate_CountBy_ME_thumb_0_0.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) **Preview** your module in Express View and open the DevTools Console. Click the button to view the list of each favorite food for the dog type. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Dwf_Aggregate_CountBy_Console_thumb_0_0.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A48Z&se=2026-11-07T18%3A57%3A48Z&sr=c&sp=r&sig=EYtRgEXGO%2BhnV%2BZXTWpiFGDqYTuFXS%2FP0V%2BY6kFVlHg%3D) ## Resource - [Input/Output Operators](/v1/docs/introduction-to-data-workflow-io-operators) - [Table Operators](/v1/docs/table-operators) A Property ID is the unique field ID used by Unqork to track and link components in your module. The DevTools Console helps you securely store, build, test, and deploy your software. Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. Express View is how your end-user views your application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View.