How to: Find the Maximum Value Using the Aggregate Operator

Prev Next

This how-to guide guides in identifying the maximum value in a data set by using the Max By function of the Aggregate operator.

Configuration

Let’s say you require the name of the oldest dog from a list of dogs. Begin with a Data Table component that stores information regarding dogs and their respective ages. Then, configure a  Data Workflow to identify and return the name of the oldest dog.

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

Configure the Data Table Component

Begin by adding your Data Table component to store a list of dogs and their ages.

  1. In the Module Builder, drag and drop a Data 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

    age

    2

    Ivy

    7

    3

    Lucy

    10

    4

    Wally

    1

    5

    Nacho

    5

    6

    Thor

    5

    7

    Holly

    13

    A static image displaying the Data table displaying names and ages of various dogs for reference.

  4. Click Save Component.

Configure the Data Workflow Component

Next, configure your Data Workflow component and an Aggregate operator to identify the oldest dog. Then, you’ll display the results using a Console operator.

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

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

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

    Oldest Dog

    Aggregation Type

    Max 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 Oldest 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 oldest dog?

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

    A static image displaying the Data workflow interface showing input, aggregate, and console components for dog information.

  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 Data Workflow component.

  2. In the Property ID field, enter btnOldestDog.

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

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

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

    A static image displaying the Button labeled 'Find Oldest Dog' with action type and trigger settings displayed.

  6. Click Save Component.

  7. Save your module.

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

A static image displaying the UDesigner Module Interface displaying a database query to find the oldest dog in a dataset.

Preview your module in Express View and open the DevTools Console. Click the Find the Oldest Dog button and you'll see the oldest dog in your Who is the oldest dog? Console operator.

This how-to guide guides in identifying the maximum value in a data set by using the Max By function of the Aggregate operator.

Configuration

Let’s say you require the name of the oldest dog from a list of dogs. Begin with a Data Table component that stores information regarding dogs and their respective ages. Then, configure a  Data Workflow to identify and return the name of the oldest dog.

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

Configure the Data Table Component

Begin by adding your Data Table component to store a list of dogs and their ages.

  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:

    #

    A

    B

    1

    name

    age

    2

    Ivy

    7

    3

    Lucy

    10

    4

    Wally

    1

    5

    Nacho

    5

    6

    Thor

    5

    7

    Holly

    13

    A static image displaying the Data table displaying names and ages of various dogs for reference.

  4. Click Save.

Configure the Data Workflow Component

Next, configure your Data Workflow component and an Aggregate operator to identify the oldest dog. Then, you’ll display the results using a Console operator.

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

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

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

    Oldest Dog

    Aggregation Type

    Max 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 Oldest 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 oldest dog?

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

    A static image displaying the Data workflow options showing input, aggregate, and console steps for finding the oldest 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 Data Workflow component.

  2. In the Property ID field, enter btnOldestDog.

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

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

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

    A static image displaying the button component configuration settings for finding the oldest dog in a workflow module.

  6. Click Save & Close.

  7. Save your module.

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

A static image displaying the Classic Designer configuration for dog data and a button to find the oldest dog.

Preview your module in Express View and open the DevTools Console. Click the Find the Oldest Dog button and you'll see the oldest dog in your Who is the oldest dog? Console operator.