Arrays are a great way to store large amounts of data. The Nest By operator lets you create a nested array in your parent array to group information by a particular key/value pair. In this example, you’ll nest data by an account number, where the account number key/value pair exists at the data structure's top level.
The account number exists as a value in the key/accountNumber pair. But you might want the account number to be the key instead of a value. Using a Table2Object operator, you'll convert your array of objects to an object. Each object in the source array of objects becomes a key/value pair in the final object. In this case, each key will be a unique account number. And the value will be the nested array associated with that account number.
Configuration
For this example, create a Data Table component that stores a list of customers, account values, and account numbers. Then, set up a Data Workflow component and convert your array of objects to an object. Each object in the source array of objects becomes a key/value pair in the final object. In this case, each key will be a unique account number, and the value will be the nested array associated with that account number. A Hidden component is added to store your Data Workflow's output.
Configure the Data Table Component
First, you'll set up a Data Table component with a list of customers, account values, and account numbers.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID fields, enter
dtAccountInfo.In the data table, enter the following:
accountNumber
firstName
lastName
accountValue
12345
Josephine
Darakjy
543891
12346
Lenna
Paprocki
1000000
12346
Sage
Wieser
1000000
12347
Abel
Maclead
7432572
12348
Ernie
Stenseth
5000000
12349
Valentine
Gillian
5439294
12346
Dyan
Oldroyd
17890
12347
Fatima
Saylors
19578
12347
Willow
Kusko
54389
You purposely added duplicate information to show the power of the Nest By operator.
.png)
Click Save Component.
Configure the Hidden Component
Now, add a Hidden component to store your Data Workflow's output.
Drag and drop a Hidden component onto your canvas, placing it below your Data Table component.
In the Property ID and Label Text fields, enter
output.Click Save Component.
Configure the Button Component
Next, add a Button component to trigger your Data Workflow component.
Drag and drop a Button component onto your canvas, placing it below your
outputHidden component.In the Property ID field, enter
btnNestToObject.In the Label Text field, enter
Nest to Object.From the Action Type drop-down, select Event.
In the On Click field, enter
dwfNestToObject..png)
Click Save Component.
Configure the Data Workflow Component
Lastly, you’ll add a Data Workflow component to convert your array of objects to an object.
Drag and drop a Data Workflow component onto your canvas, placing it below your
btnNestToObjectButton component.In the Property ID and Canvas Label Text fields, enter
dwfNestToObject.
Configure the Input Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
dtAccountInfo
Required
No
Source
Default
Configure the Nest By Operator
Drag and drop a Nest By operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Nest By
Label
accountNumber
Parent Keys
accountNumber
Child Name
account
Connect the output port (right) of the
dtAccountInfoInput operator to the input port (left) of theaccountNumberNest By operator.
Configure the Table2Object Operator
Drag and drop a Table2Object operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Table2Object
Label
Nest to Object
Key Column Name
accountNumber
Value Column Name
account
Connect the output port (right) of the
accountNumberNest By operator to the input port (left) of theNest to ObjectTable2Object operator.
Configure the Output Operator
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
output
Action
value
Connect the output port (right) of the
Nest to ObjectTable2Object operator to the input (left) port of theoutputOutput operator.
Configure the First Console Operator
Drag and drop another Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Console
Label
After Nest By
Connect the output port (right) of the
accountNumberNest By operator to the input port (left) of theAfter Nest ByConsole operator.Click Save Component.
Configure the Second Console Operator
Drag and drop another Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Console
Label
After Table2Object
Connect the output port (right) of the
Nest to ObjectTable2Object operator to the input port (left) of theAfter Table2ObjectConsole operator..png)
Click Save Component.
Save your module.
Here's how your module looks in the Module Builder:.png)
Preview your module in Express View and open the DevTools Console. Click the Nest to Object button, and you'll see your data grouped by account number in the After Nest By Console operator. In the After Table2Object Console operator, you'll see that each account number is now an array of objects. Expand a tab and you'll see the array(s) inside each object.

Arrays are a great way to store large amounts of data. The Nest By operator lets you create a nested array in your parent array to group information by a particular key/value pair. In this example, you’ll nest data by an account number, where the account number key/value pair exists at the data structure's top level.
The account number exists as a value in the key/accountNumber pair. But you might want the account number to be the key instead of a value. Using a Table2Object operator, you'll convert your array of objects to an object. Each object in the source array of objects becomes a key/value pair in the final object. In this case, each key will be a unique account number. And the value will be the nested array associated with that account number.
Configuration
For this example, create a Data Table component that stores a list of customers, account values, and account numbers. Then, set up a Data Workflow component and convert your array of objects to an object. Each object in the source array of objects becomes a key/value pair in the final object. In this case, each key will be a unique account number, and the value will be the nested array associated with that account number. A Hidden component is added to store your Data Workflow's output.
Configure the Data Table Component
First, you'll set up a Data Table component with a list of customers, account values, and account numbers.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Label and Property Name fields, enter
dtAccountInfo.In the data table, enter the following:
accountNumber
firstName
lastName
accountValue
12345
Josephine
Darakjy
543891
12346
Lenna
Paprocki
1000000
12346
Sage
Wieser
1000000
12347
Abel
Maclead
7432572
12348
Ernie
Stenseth
5000000
12349
Valentine
Gillian
5439294
12346
Dyan
Oldroyd
17890
12347
Fatima
Saylors
19578
12347
Willow
Kusko
54389
You purposely added duplicate information to show the power of the Nest By operator.
.png)
Click Save.
Configure the Hidden Component
Now, let's add a Hidden component to store your Data Workflow's output.
Drag and drop a Hidden component onto your canvas, placing it below your Data Table component.
In the Property ID and Canvas Label Text fields, enter
output.Click Save.
Configure the Button Component
Next, add a Button component to trigger your Data Workflow component.
Drag and drop a Button component onto your canvas, placing it below your
outputHidden component.In the Property ID field, enter
btnNestToObject.In the Label Text field, enter
Nest to Object.Set the Action Type as Event.
In the On Click field, enter
dwfNestToObject..png)
Click Save & Close.
Configure the Data Workflow Component
Lastly, you’ll add a Data Workflow component to convert your array of objects to an object.
Drag and drop a Data Workflow component onto your canvas, placing it below your
btnNestToObjectButton component.In the Canvas Label Text and Property Name fields, enter
dwfNestToObject.
Configure the Input Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
dtAccountInfo
Required
No
Source
Default
Configure the Nest By Operator
Drag and drop a Nest By operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Nest By
Label
accountNumber
Parent Keys
accountNumber
Child Name
account
Connect the output port (right) of the
dtAccountInfoInput operator to the input port (left) of theaccountNumberNest By operator.
Configure the Table2Object Operator
Drag and drop a Table2Object operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Table2Object
Label
Nest to Object
Key Column Name
accountNumber
Value Column Name
account
Connect the output port (right) of the
accountNumberNest By operator to the input port (left) of theNest to ObjectTable2Object operator.
Configure the Output Operator
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
output
Action
value
Connect the output port (right) of the
Nest to ObjectTable2Object operator to the input (left) port of theoutputOutput operator.
Configure the First Console Operator
Drag and drop another Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Console
Label
After Nest By
Connect the output port (right) of the
accountNumberNest By operator to the input port (left) of theAfter Nest ByConsole operator.
Configure the Second Console Operator
Drag and drop another Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Console
Label
After Table2Object
Connect the output port (right) of the
Nest to ObjectTable2Object operator to the input port (left) of theAfter Table2ObjectConsole operator..png)
Click Save.
Save your module.
Here's how your module looks in the Module Builder:
.png)
Preview your module in Express View and open the DevTools Console. Click the Nest to Object button, and you'll see your data grouped by account number in the After Nest By Console operator. In the After Table2Object Console operator, you'll see that each account number is now an array of objects. Expand a tab and you'll see the array(s) inside each object.
