Clean Object Operator: Omit Null

Overview

The Clean Object operator also lets you completely omit any null values from the data. If a field has a null value, the operator drops the field from the data. To do this, you'll just need to use the Omit Null action in the Clean Objects operator.

For this use case, you'll first create a Data Table that holds some values. You'll also add a Data Workflow component whose sole purpose is to create null values. This will let you actually test the Omit Null action.

Here's how your module will look in the Module Builder:

Here's how the completed use case will look in Express View, including a peek at the DevTools Console:

What You'll Learn

In this article, you'll learn how to use the Clean Object operator's Omit Null action type.

What You'll Need

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

  • 1 Data Table component

  • 2 Hidden components

  • 2 Data Workflow components

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

  • 1 Input operator

  • 1 Clean Object operators

  • 1 Output operator

Configuration

Configure the Data Table Component

First, you'll set up a Data Table that includes a value with a company name.

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

value

company

12

Unqork

34

Cvent

56

Trustpilot

78

BetterWorks

90

J.P. Morgan

4. Click Save.

Configure the Hidden Components

Before you can add your Data Workflows, you'll need places to store the outputs. You'll use 2 Hidden components, one for each Data Workflow.

1. Drag and drop 2 Hidden components onto your canvas, placing them below your Data Table.
2. Enter the following Property IDs and Canvas Label Text:

Property ID

Canvas Label Text

dataWithNullValues

dataWithNullValues

dataWithoutNulls

dataWithoutNulls

3. Save each component as you add it.

Configure the First Data Workflow Component

This Data Workflow component just creates the null values you'll convert with the Clean Object operator.

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

Configure the Input Data 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

dtSampleData

Required

Yes

Source

Default

Configure the Create Field Operator

This operator is going to add an extra value to the data. Now, each object includes a testField with the value of null.

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

Setting

Value

Category

Formula

Label

Create Test Field

Do Not Sanitize Formula

Checked (Yes)

Field 1

testField=NULL

Field 2

 

Field 3

 

Field 4

 

Field 5

 

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

Configure the Output Operator

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

Setting

Value

Category

Output

Component

dataWithoutNulls

Action

value

3. Connect the output port (right) of the Create Value operator to the input port (left) of the Output operator.
4. Click Save.

Configure the Second Data Workflow Component

1. Drag and drop another Data Workflow component onto your canvas.
2. Enter dwOmitNull in the Canvas Label Text and Property Name fields.

Configure the Input Data 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

dataWithNullValues

Required

Yes

Source

Default

Configure the Clean Object Operator

This operator is going to convert all the values from the dataWithNullValues

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

Setting

Value

Category

Clean Object

Label

Omit Null

Clean Action

Omit Null

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

Configure the Output Operator

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

Setting

Value

Category

Output

Component

nullToEmptyString

Action

value

3. Connect the output port (right) of the Clean Object operator to the input port (left) of the Output operator.
4. Click Save.
5. Save your module.

Now you can test your Data Workflow. Preview your module in Express View and then open the Console. You'll see the null value in testField has been omitted from the data.

Lab

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