Split Field Operator

Overview

The Split Field operator lets you separate values in one field into their own array values. This operator works by looking for a separator in your original data. A separator can be anything from a comma to a semi-colon to an underscore. You'll specify a separator in the operator's Info window. Then, the operator splits your original data wherever it finds that separator.

Let's say you have a list of end-users' full names and you want to separate that data so you have first names and last names on their own. As long as your original data contains some form of separator, the Split Field operator can do that.

The Split Field operator leaves the rest of your data as-is. But now you'll see a new array within your original array showing your separated values. So, if you need any of your original data split into individual pieces for your Data Workflow, you'll use a Split Field operator.

You’ll find the Split Field operator under the Table group at the left of the Data Workflow canvas.

What You'll Learn

In this article, you'll learn:

About the Info Window

Here's what the Split Field operator looks like, along with its Info window:

And here's a breakdown of each setting in the Info window:

Setting

Description

Category

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

Label

Sets the label for your operator. The label you enter here shows beneath your 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.

Path/Field

This is the reference key leading to the data you want to split. For example, [0] references the first row in your data set. And the key [0].name references the column labeled name in that first row.

Separator

The point where you want the operator to split your data. These are often some form of punctuation mark but can also be numbers or even a string. Common separators include: ;, :, _, and ,.

New Name

A name for the new array the Split Field operator creates. You'll find your separated values here.

If you're working with a data table, you'll see this as a new key in your table.

Adding a Split Field Operator

To see this operator in action, let's look at the example above. You'll set up a list of account details, including a column for account holders' full names. Then, you'll use a Data Workflow with a Split Field operator to separate these names at the comma.

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

Here's how the completed use case will look in Express View along with a look at the DevTools Console:

What You'll Need

To set up this use case, you’ll need:

  • 1 Data Table component

  • 1 Button component

  • 1 Data Workflow component

To set up your Data Workflow, you'll need:

  • 1 Input operator

  • 1 Split Field operator

  • 2 Console operators

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

Configure the Data Table Component

First, let's add your account data. You'll use a Data Table component for that.

1. In the Module Builder, drag and drop a Data Table component onto your canvas.
2. Enter dtAccounts in the Label and Property Name fields.
3. In the data table, enter the following:
fullName accountValue accountNumber

Fogarty, Blair

543891

12345

Kfoury, JJ

1000000

12346

Kingston, Jim

1000000

12347

Yates, Evan

7432572

12348

Miller, Charlotte

5000000

12349

Lipton, Amy

5439294

12350

4. Click Save.

Configure the Data Workflow Component

Now, let's add your Data Workflow component. You'll bring your data in using an Input operator. Then, you'll use a Split Field operator to separate values in your fullName column at the comma.

1. Drag and drop a Data Workflow component onto your canvas. Place your Data Workflow below your Data Table.
2. Enter dwfSplitName in the Canvas Label Text and Property Name fields.

Configure the Input Operator

1. Drag and drop an Input operator onto your Data Workflow canvas.
2. Configure the Input operator's Info window as follows:

Setting

Value

Category

Input

Component

dtAccounts

Required

Yes

Source

Default

Configure the First Console Operator

1. Drag and drop a Console operator onto your Data Workflow canvas.
2. Configure the Console operator's Info window as follows:

Setting

Value

Category

Console

Label

Before

3. Connect the output port (right) of the Input operator to the input port (left) of the Console operator.

Configure the Split Field Operator

1. Drag and drop a Split Field operator onto your Data Workflow canvas.
2. Configure the Split Field operator's Info window as follows:

Setting

Value

Category

Split String

Label

Split fullName

Path/Field

fullName

Separator

,

New Name

separatedNames

3. Connect the output port (right) of the Input operator to the input port (left) of the Split Field operator.

Configure the Second Console Operator

1. Drag and drop a second Console operator onto your Data Workflow canvas.
2. Configure the Console operator's Info window as follows:

Setting

Value

Category

Console

Label

After

3. Connect the output port (right) of the Split Field operator to the input port (left) of the After Console operator.
4. Click Save.

Configure the Button Component

Next, let's add a Button to trigger the whole operation.

1. Drag and drop a Button component onto your canvas. Place your Button between your Data Table and Data Workflow.
2. Enter btnSplit in the Property ID field.
3. Enter Split Full Names in the Label Text field.
4. Select Event as the Trigger Type.
5. Enter dwfSplitName in the Trigger on Click field.

6. Click Save.
7. Save your module.

Now it's time to check your work. Preview your module in Express View and open the DevTools Console. Click the Split Full Names button to run your Data Workflow. You'll see both of your Console operators in the DevTools Console. The Before Console shows your data as you entered it into your Data Table component. But your After Console looks a little different. Here, you'll see each item in your original array as normal. But if you expand those items, you'll see you have a new separatedNames array too. And your separatedNames array has the results of your Split Field operator. Here, you'll see the contents of your original fullName field split at the comma. The result is 2 separate pieces of data.

Changing a Split Field Operator's Settings

You can revisit and make changes to this operator.

1. Click the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator to open its Info Window.
4. Make changes to the operator's settings as needed.
5. Click Save.
6. Save your module.

Copying a Split Field Operator

You can make a copy of your operator using familiar keyboard settings. You can copy and paste an exact copy of your operator, matching all settings.

1. Hover over the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator you want to duplicate.
4. On your keyboard, press Command + C (Mac OS) or Ctrl + C (Windows/Linux) to copy the operator.

TIP  You can copy more than one operator at a time. Hold Command or Ctrl on your keyboard and click all the operators you want to copy. Follow the rest of the steps as usual.

5. On your keyboard, press Command + V (Mac OS) or Ctrl + V (Windows/Linux) to paste the copied operator(s) to the Data Workflow canvas.
6. Click Save.
7. Save your module.

TIP  Did you know you can copy an operator and paste it into a different Data Workflow? You'll use the same steps outlined above.

Removing a Split Field Operator

Lastly, you can delete this operator from your Data Workflow canvas. You can also use these same steps to delete a connection between two operators.

1. Hover over the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator you want to delete.
4. On your keyboard, press Delete.

NOTE  Once you delete this operator, make sure to connect your remaining operators. If your Data Workflow path doesn't end with an Output or Console operator, your Data Workflow won't work. So, once you delete an operator, make sure to update any remaining paths to end at an Output or Console operator.

5. Click Save.
6. Save your module.

Lab

You can view this complete use case here: https://training.unqork.io/#/form/6058eb437f5f6d275035282a/edit.