Nest By Operator

Prev Next

A static image displaying the Nest By operator along with its Info window in the Data Workflow canvas.

The Nest By operator creates a nested table (array of objects) in a connected parent table. Nesting arrays allows you to group rows by a shared parent key. Rows with the same parent key value are combined, and the remaining fields are nested under a specified child name key.

You'll configure the operator with a parent key that'll remain un-nested for each row. Then, you’ll provide a child name key where your new nested array will exist. This configuration lets you group rows of data by a parent key value. For example, you can nest by a parent key that has the same value across multiple rows. All rows with the same parent key value group into one row. The remaining fields nest as individual rows in the same child name array.

Keys that are not consistent across all arrays will be dropped, which can result in data loss.

You'll find the Nest By operator under the Table Operators group to the left of the Data Workflow canvas.

About the Info Window

Here's a breakdown of each setting in the Nest By operator’s Info window:

Setting

Description

Category

Grayed out and non-adjustable setting indicating the operation type.

Label

Sets the label for your operator, displaying below the operator on your Data Workflow canvas.

This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Parent Keys

The Parent Key is how you'll group your information. The nested array will contain as many rows as keys share the Parent Key value. All rows with the same Parent Key value will group into one row. All values except the Parent Key will nest as an array under the Child Name you configure for the operator.

You can also provide more than one Parent Key. This means that rows must match both keys to become nested.

Child Name

This is the key name of the nested array that you're creating. You'll see this Child Name carried through into the DevTools Console. Without a Child Name, it's difficult to find your nested array in the DevTools Console.

Adding a Nest By Operator

In this example, you'll use the Nest By operator to group by the duplicate account numbers in your Data Table component. That way, you can set the table's account number as the operator's key.

These instructions assume you have a module open, saved, and titled.

Configure the Data Table Component

First, you'll set up a Data Table component with a list of customers, account values, and account numbers.

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

  2. In the Property ID field, enter dtAccountInfo.

  3. In the data table, enter the following:

    #

    accountNumber

    firstName

    lastName

    accountValue

    1

    12345

    Josephine

    Darakjy

    543891

    2

    12346

    Lenna

    Paprocki

    1000000

    3

    12346

    Sage

    Wieser

    1000000

    4

    12347

    Abel

    Maclead

    7432572

    5

    12348

    Ernie

    Stenseth

    5000000

    6

    12349

    Valentine

    Gillian

    5439294

    7

    12346

    Dyan

    Oldroyd

    17890

    8

    12347

    Fatima

    Saylors

    19578

    9

    12347

    Willow

    Kusko

    54389

    You purposely added duplicate information to show the power of the Nest By operator.

    A static image displaying the Data Table containing accountNumber, firstName, lastName, and accountValue columns.

    4. Click on Save Component.

Configure the Button Component

To trigger the Data Workflow, you'll add a Button component.

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

  2. In the Property ID, enter btnNestByNumber.

  3. In the Label Text field, enter Nest by Account Number.

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

  5. In the Triggers On Click field, enter dwfNestByNumber.

  6. Click Save Component.

Configure the Data Workflow Component

Now, you'll set up your Data Workflow to input and nest the data from your Data Table component.

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

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

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

    dtAccountInfo

    Required

    No

    Source

    Default

Configure the Nest By Operator

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

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

    Setting

    Value

    Category

    Nest By

    Label

    Nest by accountNumber

    Parent Keys

    accountNumber

    Child Name

    account

  3. Connect the output port (right) of the dtAccountInfo Input operator to the input port (left) of the Nest by accountNumber Nest By 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

    Nest by Account Number

  3. Connect the output port (right) of the Nest by accountNumber Nest By operator to the input port (left) of the Nest by accountNumber Console operator.

  4. Click on Save Component.

  5. Save your module.

Here's how the completed example looks in the Module Builder:

Preview your module in Express View, and open the DevTools Console. Click the Nest By Account Number button, and you'll see the nine table rows grouped into five rows. Each new array now has the child name of the account. You can also see that these new arrays are nested by accountNumber.

A static image displaying the module in Express view and the data in DevTools Console.

A static image displaying the Nest By operator with its Info window in the Data Workflow canvas.The Nest By operator creates a nested table (array of objects) in a connected parent table. Nesting arrays allows you to group rows by a shared parent key. Rows with the same parent key value are combined, and the remaining fields are nested under a specified child name key.

You'll configure the operator with a parent key that'll remain un-nested for each row. Then, you’ll provide a child name key where your new nested array will exist. This configuration lets you group rows of data by a parent key value. For example, you can nest by a parent key that has the same value across multiple rows. All rows with the same parent key value group into one row. The remaining fields nest as individual rows in the same child name array.

Keys that are not consistent across all arrays will be dropped, which can result in data loss.

You'll find the Nest By operator under the Table Operators group to the left of the Data Workflow canvas.

About the Info Window

Here's a breakdown of each setting in the Nest By operator’s Info window:

Setting

Description

Category

Grayed out and non-adjustable setting indicating the operation type.

Label

Sets the label for your operator, displaying below the operator on your Data Workflow canvas.

This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Parent Keys

The Parent Key is how you'll group your information. The nested array will contain as many rows as keys share the Parent Key value. All rows with the same Parent Key value will group into one row. All values except the Parent Key will nest as an array under the Child Name you configure for the operator.

You can also provide more than one Parent Key. This means that rows must match both keys to become nested.

Child Name

This is the key name of the nested array that you're creating. You'll see this Child Name carried through into the DevTools Console. Without a Child Name, it's difficult to find your nested array in the DevTools Console.

Adding a Nest By Operator

In this example, you'll use the Nest By operator to group by the duplicate account numbers in your Data Table component. That way, you can set the table's account number as the operator's key.

These instructions assume you have a module open, saved, and titled.

Configure the Data Table Component

First, you'll set up a Data Table with a list of customers, account values, and account numbers.

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

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

  3. In the Data Table, enter the following:

    #

    accountNumber

    firstName

    lastName

    accountValue

    1

    12345

    Josephine

    Darakjy

    543891

    2

    12346

    Lenna

    Paprocki

    1000000

    3

    12346

    Sage

    Wieser

    1000000

    4

    12347

    Abel

    Maclead

    7432572

    5

    12348

    Ernie

    Stenseth

    5000000

    6

    12349

    Valentine

    Gillian

    5439294

    7

    12346

    Dyan

    Oldroyd

    17890

    8

    12347

    Fatima

    Saylors

    19578

    9

    12347

    Willow

    Kusko

    54389

    You purposely added duplicate information to show the power of the Nest By operator.

    A static image displaying the Data Table containing accountNumber, firstName, lastName, and accountValue columns.

  4. Click Save.

Configure the Button Component

To trigger the Data Workflow, you'll add a Button component.

  1. Drag and drop a Button component onto your canvas. Place your Button component below the dtAccountInfo Data Table component.

  2. In the Property ID, enter btnNestByNumber.

  3. In the Label Text field, enter Nest by Account Number.

  4. Set the Action Type as Event.

  5. In the Triggers On Click field, enter dwfNestByNumber.

  6. Click Save.

Configure the Data Workflow Component

Now, you'll set up your Data Workflow to input and nest the data from your Data Table component.

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

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

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

    dtAccountInfo

    Required

    No

    Source

    Default

Configure the Nest By Operator

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

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

    Setting

    Value

    Category

    Nest By

    Label

    Nest by accountNumber

    Parent Keys

    accountNumber

    Child Name

    account

  3. Connect the output port (right) of the dtAccountInfo Input operator to the input port (left) of the Nest by accountNumber Nest By 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

    Nest by Account Number

  3. Connect the output port (right) of the Nest by accountNumber Nest By operator to the input port (left) of the Nest by accountNumber Console operator.

  4. Click Save.

  5. Save your module.

Here's how the completed use case will look in the Module Builder:

A static image displaying the Module Builder of the final configuration.

Preview your module in Express View, and open the DevTools Console. Click the Nest By Account Number button, and you'll see the nine table rows grouped into five rows. Each new array now has the child name of the account. You can also see that these new arrays are nested by accountNumber.

A static image displaying the module in Express view and the data in DevTools Console.