In this how-to guide, you’ll use the Merge operator to add a tag to an array. An array is a data structure used to group elements. It can group values, objects, or even other arrays. Arrays index information by integer with the first index being [0], the second being [1], and so on. This index gives each element a specific position in the array. Indexes also make it easier to reference specific values.
Before you add this tag, you need to create an array. For example, when a customer places an order for a product, it’s important to display the current status of that order clearly. The array you create stores the order's basic information, like cost (in US dollars) and the name of the customer who bought it. This basic information can be organized and stored in a data table, which is then processed through a Data Workflow to ensure that everything is handled efficiently.
If you want to add order and shipping status information for the product as tags, the tags would be Order Status, Shipping Status, Pending, and Complete. Using a second Data Workflow, a Merge operator can combine the tags into the rows in your data table. This process not only organizes the data but also makes it easier to track and manage the status of each order effectively.
Configuration
In this how-to guide, you’ll create a Data Workflow to index basic product information. Then, you’ll create a second Data Workflow with a Merge operator to combine order and shipping information tags in a data table.
These instructions assume that you have an open module saved with a title.
Configure the Data Table Component
Begin by adding a Data Table component to store your sample array.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID field, enter
dtTags.In the data table, enter the following:
order
shipping
Order Status
Shipping Status
.png)
Click Save Component.
Configure the Hidden Component
Next, store your sample array in a Hidden component.
Drag and drop a Hidden component onto your canvas, placing it below your
dtTagsData Table component.In the Property ID and the Label Text fields, enter
preArray..png)
Click Save Component.
Configure the First Data Workflow Component
Now, configure a Data Workflow that creates your sample array and outputs it to the preArray Hidden component. The Data Workflow then combines your data with your end-user's name and product pricing.
Drag and drop a Data Workflow component onto your canvas, placing it above your
preArrayHidden component.In the Property ID and Canvas Label Text fields, enter
dwfCreateSampleArray.
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
dtTags
Required
Yes
Source
Default
Configure the First Col2Array Operator
Drag and drop the first Col2Array operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Col2Array
Label
Order
Drop Empty
Yes
Path
order
Default Value
Connect the output port (right) of the
dtTagsInput operator to the input port (left) of theOrderCol2Array operator.
Configure the Second Col2Array Operator
Drag and drop the second Col2Array operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Col2Array
Label
Shipping
Drop Empty
Yes
Path
shipping
Default Value
Connect the output port (right) of the
dtTagsInput operator to the input port (left) of theShippingCol2Array operator.
Configure the Create Table Operator
Drag and drop a Create Table operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Create Table
Label
Rows
Create Index
No
Number of Rows
1
Configure the First Set Operator
Drag and drop a Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
Path1
Path
[0].tags
Value
Connect the output port (right) of the
RowsCreate Table operator to the upper input port (left) of thePath1Set operator.Connect the output port (right) of the
OrderCol2Array operator to the lower input port (left) of thePath1Set operator.
Configure the Second Set Operator
Drag and drop another Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
Path2
Path
[0].tags
Value
Connect the output port (right) of the
RowsCreate Table operator to the upper input port (left) of thePath2Set operator.Connect the output port (right) of the
ShippingCol2Array operator to the lower input port (left) of thePath2Set operator.
Configure the Append Operator
Drag and drop an Append operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Append
Label
preArray
Connect the output port (right) of the
Path1Set operator to the upper input port (left) of thepreArrayAppend operator.Connect the output port (right) of the
Path2Set operator to the lower input port (left) of thepreArrayAppend operator.
Configure the Create Field Operator
Drag and drop a Create Field operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Formula
Label
Customer
Do Not Sanitize Formula
(checked)Field 1
firstName = "Willow"
Field 2
lastName = "Kusko"
Field 3
price = "$16.99"
Field 4
Field 5
Connect the output port (right) of the
preArrayAppend operator to the input port (left) of theCustomerCreate Field 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
preArray
Action
value
Connect the output port (right) of the
CustomerCreate Field operator to the input port (left) of thepreArrayOutput operator..png)
Click Save Component.
Configure the Initializer Component
Now, configure an Initializer component to trigger your Data Workflow.
Drag and drop an Initializer component onto your canvas, placing it above your
dtTagsData Table component.In the Property ID and Canvas Label Text fields, enter
initCreateArray.From the Trigger Type drop-down, select New Submission.
In the Outputs table, enter the following:
Property ID
Type
Value
dwfCreateSampleArray
trigger
GO
.png)
Click Save Component.
Configure the Text Field Component
Now that you have your sample array created, set up another Data Workflow to create a tag in that array. Begin by configuring a Text Field component so that your end-user can enter a tag into the array.
Drag and drop a Text Field component onto your canvas, placing it below the
preArrayHidden component.In the Property ID field, enter
tagStatus.In the Label Text field, enter
Status..png)
Click Save Component.
Configure the Second Data Workflow Component
The second Data Workflow lets the end-user create a tag. The Data Workflow merges that single tag into both rows of your data table. So, one tag populates the customer's order and shipping statuses. In this example, you’ll merge using the Merge operator’s Inner and leave the Merge Key empty. Leaving out a Merge Key combines your sample array, data table, and the tag values.
Drag and drop a Data Workflow component onto your canvas, placing it below your
tagStatusText Field component.In the Property ID and Canvas Label Text fields, enter
dwfAddSameTagEveryRow.
Configure the First 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
tagStatus
Required
Yes
Source
Default
Configure the Second Input Operator
Drag and drop another Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
preArray
Required
Yes
Source
Default
Configure the Create Table Operator
Drag and drop a Create Table operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Create Table
Label
tag
Create Index
No
Number of Rows
0
Configure the Set Operator
Drag and drop a Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
createTag
Path
[0].tags[0]
Value
Connect the output port (right) of the
tagCreate Table operator to the upper input port (left) of thecreateTagSet operator.Connect the output port (right) of the
tagStatusInput operator to the lower input port (left) of thecreateTagSet operator.
Configure the Merge Operator
Drag and drop a Merge operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Merge
Label
mergeTag
Merge Type
Inner
Keep Flag
False
Renaming
Push
Rows to Keep
First
Merge Key
Connect the output port (right) of the
preArrayInput operator to the upper input port (left) of themergeTagMerge operator.Connect the output port (right) of the
createTagSet operator to the lower input port (left) of themergeTagMerge operator.
Configure the First Console Operator
Lastly, add two Console operators to view the progress of your Data Workflow. The first connects to the output of the Set operator. The second Console connects to the output of the Merge operator.
Drag and drop a Console operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Console
Label
createTagArray
Connect the output port (right) of the
createTagSet operator to the input port (left) of thecreateTagArrayConsole 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
merge
Connect the output port (right) of the
mergeTagMerge operator to the input port (left) of themergeConsole operator..png)
Click Save Component.
Configure the Button Component
Now, configure a Button component to trigger your Data Workflow.
Drag and drop a Button component onto your canvas, placing it above your
dwfAddSameTagEveryRowData Workflow component.In the Property ID field, enter
btnAddTag.In the Label Text field, enter
Add Status Tag to Every Row.From the Action Type drop-down, select Event.
In the On Click drop-down, select dwfAddSameTagEveryRow.
.png)
Click Save Component.
Save your module.
Here's how your completed module looks in the Module Builder:
.png)
Preview your module in Express View and open the DevTools Console. In the Status field, enter Complete and click the Add Status Tag to Every Row button. In the image below, you can see the tags added to each array.
.png)
In this how-to guide, you’ll use the Merge operator to add a tag to an array. An array is a data structure used to group elements. It can group values, objects, or even other arrays. Arrays index information by integer with the first index being [0], the second being [1], and so on. This index gives each element a specific position in the array. Indexes also make it easier to reference specific values.
Before you add this tag, you need to create an array. For example, when a customer places an order for a product, it’s important to display the current status of that order clearly. The array you create stores the order's basic information, like cost (in US dollars) and the name of the customer who bought it. This basic information can be organized and stored in a data table, which is then processed through a Data Workflow to ensure that everything is handled efficiently.
If you want to add order and shipping status information for the product as tags, the tags would be Order Status, Shipping Status, Pending, and Complete. Using a second Data Workflow, a Merge operator can combine the tags into the rows in your data table. This process not only organizes the data but also makes it easier to track and manage the status of each order effectively.
Configuration
In this how-to guide, you’ll create a Data Workflow to index basic product information. Then, you’ll create a second Data Workflow with a Merge operator to combine order and shipping information tags in a data table.
These instructions assume that you have an open module saved with a title.
Configure the Data Table Component
Begin by adding a Data Table component to store your sample array.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Label and Property Name fields, enter
dtTags.In the data table, enter the following:
order
shipping
Order Status
Shipping Status
.png)
Click Save.
Configure the Hidden Component
Next, store your sample array in a Hidden component.
Drag and drop a Hidden component onto your canvas, placing it below your
dtTagsData Table component.In the Property ID and the Canvas Label Text fields, enter
preArray..png)
Click Save.
Configure the First Data Workflow Component
Now, configure a Data Workflow that creates your sample array and outputs it to the preArray Hidden component. The Data Workflow then combines your data with your end-user's name and product pricing.
Drag and drop a Data Workflow component onto your canvas, placing it above your
preArrayHidden component.In the Canvas Label Text and Property Name fields, enter
dwfCreateSampleArray.
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
dtTags
Required
Yes
Source
Default
Configure the First Col2Array Operator
Drag and drop the first Col2Array operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Col2Array
Label
Order
Drop Empty
Yes
Path
order
Default Value
Connect the output port (right) of the
dtTagsInput operator to the input port (left) of theOrderCol2Array operator.
Configure the Second Col2Array Operator
Drag and drop the second Col2Array operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Col2Array
Label
Shipping
Drop Empty
Yes
Path
shipping
Default Value
Connect the output port (right) of the
dtTagsInput operator to the input port (left) of theShippingCol2Array operator.
Configure the Create Table Operator
Drag and drop a Create Table operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Create Table
Label
Rows
Create Index
No
Number of Rows
1
Configure the First Set Operator
Drag and drop a Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
Path1
Path
[0].tags
Value
Connect the output port (right) of the
RowsCreate Table operator to the upper input port (left) of thePath1Set operator.Connect the output port (right) of the
OrderCol2Array operator to the lower input port (left) of thePath1Set operator.
Configure the Second Set Operator
Drag and drop another Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
Path2
Path
[0].tags
Value
Connect the output port (right) of the
RowsCreate Table operator to the upper input port (left) of thePath2Set operator.Connect the output port (right) of the
ShippingCol2Array operator to the lower input port (left) of thePath2Set operator.
Configure the Append Operator
Drag and drop an Append operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Append
Label
preArray
Connect the output port (right) of the
Path1Set operator to the upper input port (left) of thepreArrayAppend operator.Connect the output port (right) of the
Path2Set operator to the lower input port (left) of thepreArrayAppend operator.
Configure the Create Field Operator
Drag and drop a Create Field operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Formula
Label
Customer
Do Not Sanitize Formula
(checked)Field 1
firstName = "Willow"
Field 2
lastName = "Kusko"
Field 3
price = "$16.99"
Field 4
Field 5
Connect the output port (right) of the
preArrayAppend operator to the input port (left) of theCustomerCreate Field 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
preArray
Action
value
Connect the output port (right) of the
CustomerCreate Field operator to the input port (left) of thepreArrayOutput operator..png)
Click Save.
Configure the Initializer Component
Now, configure an Initializer component to trigger your Data Workflow.
Drag and drop an Initializer component onto your canvas, placing it above your
dtTagsData Table component.In the Property ID and Canvas Label Text fields, enter
initCreateArray.From the Trigger Type drop-down, select New Submission.
In the Outputs table, enter the following:
Property ID
Type
Value
dwfCreateSampleArray
trigger
GO
.png)
Click Save & Close.
Configuration
Configure the Text Field Component
Now that you have your sample array created, set up another Data Workflow to create a tag in that array. Begin by configuring a Text Field component so that your end-user can enter a tag into the array.
Drag and drop a Text Field component onto your canvas, placing it below the
preArrayHidden component.In the Property ID field, enter
tagStatus.In the Label Text field, enter
Status..png)
Click Save & Close.
Configure the Second Data Workflow Component
The second Data Workflow lets the end-user create a tag. The Data Workflow merges that single tag into both rows of your data table. So, one tag populates the customer's order and shipping statuses. In this example, you’ll merge using the Merge operator’s Inner and leave the Merge Key empty. Leaving out a Merge Key combines your sample array, data table, and the tag values.
Drag and drop a Data Workflow component onto your canvas, placing it below your
tagStatusText Field component.In the Property ID and Canvas Label Text fields, enter
dwfAddSameTagEveryRow.
Configure the First 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
tagStatus
Required
Yes
Source
Default
Configure the Second Input Operator
Drag and drop another Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
preArray
Required
Yes
Source
Default
Configure the Create Table Operator
Drag and drop a Create Table operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Create Table
Label
tag
Create Index
No
Number of Rows
0
Configure the Set Operator
Drag and drop a Set operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Set
Label
createTag
Path
[0].tags[0]
Value
Connect the output port (right) of the
tagCreate Table operator to the upper input port (left) of thecreateTagSet operator.Connect the output port (right) of the
tagStatusInput operator to the lower input port (left) of thecreateTagSet operator.
Configure the Merge Operator
Drag and drop a Merge operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Merge
Label
mergeTag
Merge Type
Inner
Keep Flag
False
Renaming
Push
Rows to Keep
First
Merge Key
Connect the output port (right) of the
preArrayInput operator to the upper input port (left) of themergeTagMerge operator.Connect the output port (right) of the
createTagSet operator to the lower input port (left) of themergeTagMerge operator.
Configure the First Console Operator
Lastly, add two Console operators to view the progress of your Data Workflow. The first connects to the output of the Set operator. The second Console connects to the output of the Merge operator.
Drag and drop a Console operator onto your Data Workflow canvas.
Configure the operator’s Info window as follows:
Setting
Value
Category
Console
Label
createTagArray
Connect the output port (right) of the
createTagSet operator to the input port (left) of thecreateTagArrayConsole 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
merge
Connect the output port (right) of the
mergeTagMerge operator to the input port (left) of themergeConsole operator..png)
Click Save.
Configure the Button Component
Now, configure a Button component to trigger your Data Workflow.
Drag and drop a Button component onto your canvas, placing it above your
dwfAddSameTagEveryRowData Workflow component.In the Property ID field, enter
btnAddTag.In the Label Text field, enter
Add Status Tag to Every Row.Set the Action Type as Event.
From the On Click drop-down, select dwfAddSameTagEveryRow.
.png)
Click Save & Close.
Save your module.
Here's how your completed module looks in the Module Builder:
.png)
Preview your module in Express View and open the DevTools Console. In the Status field, enter Complete and click the Add Status Tag to Every Row button. In the image below, you can see the tags added to each array.
.png)