Overview
The Data Workflow component's Clean Keys operator replaces empty or missing values with a string or number value.
In a module, table data stores in an array. An array organizes data into keys and values. The Clean Keys operator uses key names to create new keys and fill their values, or fill values in an existing key.
The operator has the following options for filling in data values:
Missing: Fills values for existing and non-existing keys. Adds a key if it does not exist in your data, and fills all values for that key.
Empty: Creates values in your data for existing keys.
Empty: Creates values in your data for existing keys.
You’ll find the Clean Keys operator under the Table group to the left of your Data Workflow canvas.
About the Info Window
Learn more about each setting in the Clean Keys operator's Info window:
Setting | Value |
---|---|
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. |
Fill If | Select the types of keys or values that are modified by the operator:
|
Keys | Enter your key names here for the following:
|
Fill With | The value entered replaces the empty or missing value. If your key is Missing and does not exist on your data set, this field adds all data under the new key field. If your field is Empty, this field fills the values under the key name you entered. |
Adding a Clean Keys Operator
Set up a data table that records employee AWS (Amazon Web Services) certification. Use a Data Workflow and Clean Keys operator to replace empty certification values with a value of none
. Then, display the modified data using a ViewGrid component.
Configure the Data Table Component
Add a Data Table component containing the certification data with missing values.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID field, enter dtAWSCertData.
In the data table, enter the following:
A
B
C
D
1
firstName
certification
accountValue
dateOfBirth
2
Blair
aws solutions architect
1000000
07/23/90
3
JJ
678900
02/26/89
4
Jim
1000000
01/04/88
5
Evan
aws developer
null
6
Charlotte
aws security
5000000
02/01/91
7
Amy
aws database
5439294
8
Brian
aws machine learning
Click Save Component.
Configure the Hidden Component
Add a Hidden component to store the output from the Data Workflow component. You'll set up a Data Workflow in the next section.
Drag and drop a Hidden component onto your canvas, placing it below your dtAWSCertData Data Table component.
In the Property ID and Label Text fields, enter
addedCert
.Click Save Component.
Configure the Data Workflow Component
Next, add a Data Workflow component and configure a Clean Keys operator to locate and replace missing values in the dtAWSCertData Data Table component's certification column. Additionally, add Console operators to view how the data is modified by the Clean Keys operator.
Drag and drop a Data Workflow component onto your canvas, placing it between the dtAWSCertData
Data Table and addedCert Hidden components.
In the Property ID field, enter dwfFillKeysIfEmpty.
In the Canvas Label Text, enter
dwfFillKeysIfEmpty
.
Configure the Input Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Input
Component
dtAWSCertData
Required
Yes
Source
Default
Configure the First Console Operator
Next, configure a Console operator to display the dtAWSCertData data before manipulation.
Drag and drop a Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Console
Label
Input Data
Connect the output port (right) of the dtAWSCertData Input operator to the input port (left) of the Input Data Console operator.
Configure the Clean Keys Operator
Add the Clean Keys operator to fill the empty values in the certification column with a value of none
.
Drag and drop a Clean Keys operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Clean Keys
Label
Fill Certification
Preserve Argument Type
☐ (unchecked)
Fill If
Empty
Keys
certification
Fill With
none
Connect the output port (right) of the dtAWSCertData Input operator to the input port (left) of the Fill Certification Clean Keys operator.
Configure the Second Console Operator
Add another Console operator to display the dtAWSCertData data after it passes through the Clean Keys operator.
Drag and drop a Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Console
Label
Fill Certification
Connect the output port (right) of the Fill CertificationClean Keys operator to the input port (left) of the Fill Certification Console operator.
Configure the Output Operator
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Output
Component
addedCert
Action
value
Connect the output port (right) of the Fill Certification Clean Keys operator to the input port (left) of the addedCert Output operator.
Click Save Component.
Here's how the completed Data Workflow looks:
Configure the ViewGrid Component
Set up a ViewGrid component to display the data after the Data Workflow manipulates the empty certification keys.
Drag and drop a ViewGrid component onto your canvas, placing it below your dwfFillKeysIfEmpty Data Workflow component.
In the Property ID field, enter vgCertificates.
In theCanvas Label Text, enter
vgCertificates
.Navigate to the Data settings.
In the Inputs table, enter the following:
Source
Required
1
addedCert
☐ (unchecked)
In the Display table, enter the following:
Display
Formula
Heading
Type
1
firstName
First Name
2
certification
Certification
3
accountValue
Account Value
4
dateOfBirth
Date of Birth
Navigate to the Actions settings.
In the Action field, enter
null
.Click Save Component.
Configure the Button Component
Lastly, configure a Button component to trigger the Data Workflow.
Drag and drop a Button component onto your canvas, placing it below the dwfSet Data Workflow component.
In the Property ID field, enter btnFillKeys.
In the Label Text field, enter
Fill Keys
.Navigate to the Actions settings.
From the Action Type drop-down, select Event.
From the On Click drop-down, enter or select dwfFillKeysIfEmpty.
Click Save Component.
Save your module.
Your completed module looks like the following:
Preview your module in Express View and open the DevTools Console. Click Fill Keys. Open each Console operator array and observe the difference between the certification values. The Clean Keys operator replaces missing certification values with the value of none
.
Overview
The Data Workflow component's Clean Keys operator replaces empty or missing values with a string or number value.
In a module, table data stores in an array. An array organizes data into keys and values. The Clean Keys operator uses key names to create new keys and fill their values, or fill values in an existing key.
The operator has the following options for filling in data values:
Missing: Fills values for existing and non-existing keys. Adds a key if it does not exist in your data, and fills all values for that key.
Empty: Creates values in your data for existing keys.
Empty: Creates values in your data for existing keys.
You’ll find the Clean Keys operator under the Table group to the left of your Data Workflow canvas.
About the Info Window
Learn more about each setting in the Clean Keys 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. |
Fill If | Select the types of keys or values that are modified by the operator:
|
Keys | Enter your key names here for the following:
|
Fill With | The value entered replaces the empty or missing value. If your key is Missing and does not exist on your data set, this field adds all data under the new key field. If your field is Empty, this field fills the values under the key name you entered. |
Adding a Clean Keys Operator
Set up a data table that records employee AWS (Amazon Web Services) certification. Use a Data Workflow and Clean Keys operator to replace empty certification values with a value of none
. Then, display the modified data using a ViewGrid component.
Configure the Data Table Component
Add a Data Table component containing the certification data with missing values.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID and Canvas Label Text fields, enter
dtAWSCertData
.In the data table, enter the following:
A
B
C
D
1
firstName
certification
accountValue
dateOfBirth
2
Blair
aws solutions architect
1000000
07/23/90
3
JJ
678900
02/26/89
4
Jim
1000000
01/04/88
5
Evan
aws developer
null
6
Charlotte
aws security
5000000
02/01/91
7
Amy
aws database
5439294
8
Brian
aws machine learning
Click Save & Close.
Configure the Hidden Component
Add a Hidden component to store the output from the Data Workflow component. You'll set up a Data Workflow in the next section.
Drag and drop a Hidden component onto your canvas, placing it below your dtAWSCertData Data Table component.
In the Property ID and Label Text fields, enter
addedCert
.Click Save & Close.
Configure the Data Workflow Component
Next, add a Data Workflow component and configure a Clean Keys operator to locate and replace missing values in the dtAWSCertData Data Table component's certification column. Additionally, add Console operators to view how the data is modified by the Clean Keys operator.
Drag and drop a Data Workflow component onto your canvas, placing it between the dtAWSCertData Data Table . and addedCert Hidden components.
In the Canvas Label Text and Property Name fields, enter
dwfFillKeysIfEmpty
.
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
dtAWSCertData
Required
Yes
Source
Default
Configure the First Console Operator
Next, configure a Console operator to display the dtAWSCertData data before manipulation.
Drag and drop a Console operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Console
Label
Input Data
Connect the output port (right) of the dtAWSCertData Input operator to the input port (left) of the Input Data Console operator.
Configure the Clean Keys Operator
Add the Clean Keys operator to fill the empty values in the certification column with a value of none
.
Drag and drop a Clean Keys operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Clean Keys
Label
Fill Certification
Preserve Argument Type
☐ (unchecked)
Fill If
Empty
Keys
certification
Fill With
none
Connect the output port (right) of the dtAWSCertData Input operator to the input port (left) of the Fill Certification Clean Keys operator.
Configure the Second Console Operator
Add another Console operator to display the dtAWSCertData data after it passes through the Clean Keys 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
Fill Certification
Connect the output port (right) of the Fill CertificationClean Keys operator to the input port (left) of the Fill Certification Console 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
addedCert
Action
value
Connect the output port (right) of the Fill Certification Clean Keys operator to the input port (left) of the addedCert Output operator.
Click Save.
Here's how the completed Data Workflow looks:
Configure the ViewGrid Component
Set up a ViewGrid component to display the data after the Data Workflow manipulates the empty certification keys.
Drag and drop a ViewGrid component onto your canvas, placing it below your dwfFillKeysIfEmpty Data Workflow component.
In the Property ID field, enter vgCertificates.
In theCanvas Label Text, enter
vgCertificates
.Navigate to the Data settings.
In the Inputs table, enter the following:
Source
Required
1
addedCert
☐ (unchecked)
In the Display table, enter the following:
Display
Formula
Heading
Type
1
firstName
First Name
2
certification
Certification
3
accountValue
Account Value
4
dateOfBirth
Date of Birth
Navigate to the Actions settings.
In the Action field, enter
null
.Click Save.
Configure the Button Component
Lastly, configure a Button component to trigger the Data Workflow.
Drag and drop a Button component onto your canvas, placing it below the dwfSet Data Workflow component.
In the Property ID field, enter btnFillKeys.
In the Label Text field, enter
Fill Keys
.Navigate to the Actions settings.
Set the Action Type to Event.
In the On Click field, enter or select dwfFillKeysIfEmpty.
Click Save & Close.
Save your module.
Your completed module looks like the following:
Preview your module in Express View and open the DevTools Console. Click Fill Keys. Open each Console operator array and observe the difference between the certification values. The Clean Keys operator replaces missing certification values with the value of none
.