How to: Find the Lowest Value Using the Min By Function

Prev Next

To identify the lowest value in a data set, use the Aggregate operator’s Min By function.

Configuration

Let’s say you have a Data Table component containing a list of dogs and their ages, and wish to determine the youngest dog to ensure they receive additional playtime. You can configure a Data Workflow and an Aggregate operator to return the name of the youngest dog.

These instructions assume you have a new module open, saved, and with a title.

Configure the Data Table Component

Begin by adding a Data Table component to store your sample dog data.

  1. In the Module Builder, drag and drop a Data Table component onto your canvas.

  2. In the Property ID, enter dtDogs.

  3. In the data table, enter the following:

    name

    age

    Ivy

    7

    Lucy

    10

    Wally

    1

    Nacho

    5

    Thor

    5

    Holly

    13

    A static image displaying the Data table listing dog names and their corresponding ages for reference.

  4. Click Save Component.

Configure the Data Workflow Component

Next, configure a Data Workflow component and an Input operator to bring in the data from the Data Table component. Then, add an Aggregate operator to find the youngest dog. Lastly, you’ll add a Console operator to view the results in the DevTools Console.

  1. Drag and drop a Data Workflow onto your canvas, placing it below your dtDogs Data Table component.

  2. In the Property ID and Canvas Label Text fields, enter dwfYoungest.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data 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 Aggregate operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Aggregate By

    Label

    Youngest Dog

    Aggregation Type

    Min By

    Join Group Keys

    No

    Group Key

    Value Key

    age

  3. Connect the output port (right) of the dtDogs Input operator to the input port (left) of the Youngest Dog Aggregate operator.

Configure the Console Operator

  1. Drag and drop a Console operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Console

    Label

    Who is the youngest dog?

  3. Connect the output port (right) of the Youngest Dog Aggregate operator to the input port (left) of the Who is the youngest dog? Console operator.

    A static image displaying the Data workflow configuration showing property ID and console for youngest dog query.

  4. Click Save Component.

Configure the Button Component

Lastly, configure a Button component to trigger your Data Workflow.

  1. Drag and drop a Button component onto your canvas, placing it below your dwfYoungest Data Workflow component.

  2. In the Property ID field, enter btnYoungestDog.

  3. In the Label Text field, enter Find Youngest Dog.

  4. From the Action Type drop-down, select Event.

  5. From the On Click drop-down, select dwfYoungest.

    A static image displaying the Button labeled 'Find Youngest Dog' with action triggers for event handling.

  6. Click Save Component.

  7. Save your module.

Here's how your completed module looks in the Module Builder:

A static image displaying the Module Builder Configuration a database query for finding the youngest dog in a list.

Preview your module in Express View and open the DevTools Console. Click the Find Youngest Dog button, and you'll see the youngest dog from your Who is the youngest dog? Console.

A static image displaying the DevTools Console output showing the youngest dog named Wally with age information.

To identify the lowest value in a data set, use the Aggregate operator’s Min By function.

Configuration

Let’s say you have a Data Table component containing a list of dogs and their ages, and wish to determine the youngest dog to ensure they receive additional playtime. You can configure a Data Workflow and an Aggregate operator to return the name of the youngest dog.

These instructions assume you have a new module open, saved, and with a title.

Configure the Data Table Component

Begin by adding a Data Table component to store your sample dog data.

  1. In the Module Builder, drag and drop a Data Table component onto your canvas.

  2. In the Label and Property Name fields, enter dtDogs.

  3. In the data table, enter the following:

    name

    age

    Ivy

    7

    Lucy

    10

    Wally

    1

    Nacho

    5

    Thor

    5

    Holly

    13

    A static image displaying the Data table displaying dog names and their corresponding ages for reference.

  4. Click Save.

Configure the Data Workflow Component

Next, configure a Data Workflow component and an Input operator to bring in the data from the Data Table component. Then, add an Aggregate operator to find the youngest dog. Lastly, you’ll add a Console operator to view the results in the DevTools Console.

  1. Drag and drop a Data Workflow onto your canvas, placing it below your dtDogs Data Table component.

  2. In the Canvas Label Text and Property Name fields, enter dwfYoungest.

Configure the Input Operator

  1. Drag and drop an Input operator onto your Data 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 Aggregate operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Aggregate By

    Label

    Youngest Dog

    Aggregation Type

    Min By

    Join Group Keys

    No

    Group Key

    Value Key

    age

  3. Connect the output port (right) of the dtDogs Input operator to the input port (left) of the Youngest Dog Aggregate operator.

Configure the Console Operator

  1. Drag and drop a Console operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Console

    Label

    Who is the youngest dog?

  3. Connect the output port (right) of the Youngest Dog Aggregate operator to the input port (left) of the Who is the youngest dog? Console operator.

    A static image displaying the Data workflow configuration showing input, aggregate, and console components for finding the youngest dog.

  4. Click Save.

Configure the Button Component

Lastly, configure a Button component to trigger your Data Workflow.

  1. Drag and drop a Button component onto your canvas, placing it below your dwfYoungest Data Workflow component.

  2. In the Property ID field, enter btnYoungestDog.

  3. In the Label Text field, enter Find Youngest Dog.

  4. Set the Action Type as Event.

  5. From the On Click drop-down, select dwfYoungest.

    A static image displaying the button configuration for finding the youngest dog with action triggers and user feedback.

  6. Click Save & Close.

  7. Save your module.

Here's how your completed module looks in the Module Builder:

A static image displaying the Module Builder configuration for dog data and a button to find the youngest dog.

Preview your module in Express View and open the DevTools Console. Click the Find Youngest Dog button, and you'll see the youngest dog from your Who is the youngest dog? Console.

A static image displaying the DevTools Console output showing the youngest dog named Wally with age information.