Convert Field Operator

Overview

A static image displaying the Data Workflow component's Convert Field Operator icon and information window.

The Convert Field operator lets you change the data type Data types are a classification of data that determines how it is stored and interpreted. of values stored in specific fields of a data set. You can convert these values into numbers, integers, or strings A string is an object that represents a sequence of characters. Strings typically hold data represented in text form..

The operator only works on fields in objects. If you pass an entire object, the returned result is [object, object].

Before understanding the operator in detail, here's an overview of these three data types:

  • Number: This data type represents numerical values, including decimals. If the original value contains non-numerical characters, the result displays as NaN (Not a Number). To avoid lost data, ensure your original data excludes non-numerical characters.

  • Integer: This data type represents numerical values, but it does not allow decimals. If the original value contains non-numerical characters, the result defaults to 0. Use integers when you need clean, whole-number results.

  • String: This data type represents text, but can include numbers, letters, symbols, and spaces. You'll sometimes see strings referred to as text that can be as short as a few letters or contain entire paragraphs.

The Unqork Designer Platform handles each data type differently. At times, you'll need to convert the data collected in a field from one type to another. The Convert Field operator lets you convert entire columns of a data table or fields into an array An array is a type of object that stores one or more data types. Data types supported in arrays include numbers, strings, and objects. simultaneously.

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

Similar Data Workflow Operators

The Convert Field operator is similar to the Convert Value operator.

  • Convert Value operator: Converts a single value passed to it. This operator is best used when you're only working with a single key/value pair of data.

About the Info Window

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

Info

Category

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

Label

The name applied to the operator. This label displays within the workflow. Labels should be user-friendly and well associated with the role of the operator.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Cast To

The final data type you want after the operator performs its conversion. Here, you'll find a drop-down with the following options:

  • Number

  • Integer

  • String

Keys

Enter the key for any data you want the operator to convert. When working with a data table, the key is the header name of the column you want converted. You can convert more than one key using a single operator. Separate each new key in this field by a comma.

You can also set your keys using an argument. Connect an Input operator to the operator's argument port. Then, enter _arg in this field. Remember, the value passed using an argument must match a key in your data set.

Adding a Convert Field Operator

In this example, you'll configure a Data Table component to store the account information as a string data type. Then, you'll configure a Data Workflow that converts your Account Value column into a number data type.

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

Configure the Data Table Component

First, you'll configure a Data Table component to store your account data and input it later into a Data Workflow component.

1. In the Module Builder, drag and drop a Dropdown Component IconData Table component onto your canvas.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter dtAccounts.
3. In the data table, enter the following:
 

A

B C

1

firstName

certification accountValue

2

Blair

aws solutions architect

$1000000

3

JJ

 

$6789.00

4

Jim

 

1000000

5

Evan

aws developer

null

6

Charlotte

aws security

5000000

7

Amy

aws database

$5439294

8

Brian

aws machine learning

$178.90

9

Rupert

null

195.78

10

Emily

aws networking specialty

nine hundred thousand

A static image displaying the list of names, certifications and their account values.

4. Click Save Component.

Configure the Data Workflow Component

Next, configure a Data Workflow component to convert the accountValue column into a number data type. First, use an Input operator to bring in the data. Then, use a Convert Field operator with the Cast To field set to Number. Later you'll include two Console operators so you can view what your data looks like before and after the conversion.

1. Drag and drop a Data Workflow onto your canvas, placing it below the Dropdown Component IconData Table component.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . fields, enter dwfConvertFieldNumber.

Configure the Input Operator

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

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 operator's Info window as follows:

Info

Category

Console

Label

Before

3. Connect the output port (right) of the dtAccountsInput operator to the input port (left) of the BeforeConsole operator.

Configure the Convert Field Operator

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

Info

Category

Convert To

Label

Convert accountValue to Number

Cast To

Number

Keys

accountValue

3. Connect the output port (right) of the dtAccountsInput operator to the input port (left) of the Convert accountValue to NumberConvert Field operator.

Configure the Second Console Operator

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

Info

Category

Console

Label

After

3. Connect the output port (right) of the Convert accountValue to NumberConvert Field operator to the input port (left) of the After Console operator.

A static image displaying the data workflow configuration which converts the field data type.

4. Click Save Component.

Configure the Button Component

Lastly, add a Button component to trigger the Data Workflow and convert the data type of accountValue column.

1. Drag and drop a Button component Icon Button component onto your canvas, placing it between your Dropdown Component IconData Table and Data Workflow components.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter btnConvert.
3. In the Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. field, enter Convert to Number.
4. From the Action Type drop-down, select Event.
5. From the On Click drop-down, select dwfConvertFieldNumber.

A static image displaying the Button component's completed configuration in the configuration window.

6. Click Save Component.
7. Save your module.

Here's how the completed example looks in the Module Builder:

A static image displaying the completed configuration in the Module Builder.

Preview your module in Express View Express View is how your end-user views your application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View. and open the DevTools Console The DevTools Console helps you securely store, build, test, and deploy your software.. Click the button and run the Angular command The Angular command, or data command, is a tool that displays submission data in a browser's developer console. In Express View, enter the following command in the devtool console: angular.element('.unqorkio-form').scope().submission. Now, expand the data in your Before Console operator, you'll see the data as you entered it into your Data Table component. Expand the data in your After Console operator and you'll see that your account values have been converted to numbers. Remember, NaN means Not a Number, and you'll see this anywhere your original data included non-numerical characters.

A static image displaying the data conversion in the DevTools Console in Express View.

Overview

A static image displaying the Classic Dessigner's- Data Workflow component's ConvertField Operator icon and information window.

The Convert Field operator lets you change the data type Data types are a classification of data that determines how it is stored and interpreted. of values stored in specific fields of a data set. You can convert these values into numbers, integers, or strings A string is an object that represents a sequence of characters. Strings typically hold data represented in text form..

The operator only works on fields in objects. If you pass an entire object, the returned result is [object, object].

Before understanding the operator in detail, here's an overview of these three data types:

  • Number: This data type represents numerical values, including decimals. If the original value contains non-numerical characters, the result displays as NaN (Not a Number). To avoid lost data, ensure your original data excludes non-numerical characters.

  • Integer: This data type represents numerical values, but it does not allow decimals. If the original value contains non-numerical characters, the result defaults to 0. Use integers when you need clean, whole-number results.

  • String: This data type represents text, but can include numbers, letters, symbols, and spaces. You'll sometimes see strings referred to as text that can be as short as a few letters or contain entire paragraphs.

The Unqork Designer Platform handles each data type differently. At times, you'll need to convert the data collected in a field from one type to another. The Convert Field operator lets you convert entire columns of a data table or fields into an array An array is a type of object that stores one or more data types. Data types supported in arrays include numbers, strings, and objects. simultaneously.

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

Similar Data Workflow Operators

The Convert Field operator is similar to the Convert Value operator.

  • Convert Value operator: Converts a single value passed to it. This operator is best used when you're only working with a single key/value pair of data.

About the Info Window

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

The name applied to the operator. This label displays within the workflow. Labels should be user-friendly and well associated with the role of the operator.

Preserve Argument Type

When selected, this setting ensures the argument data type is respected when the operator executes.

Cast To

The final data type you want after the operator performs its conversion. Here, you'll find a drop-down with the following options:

  • Number

  • Integer

  • String

Keys

Enter the key for any data you want the operator to convert. When working with a data table, the key is the header name of the column you want converted. You can convert more than one key using a single operator. Separate each new key in this field by a comma.

You can also set your keys using an argument. Connect an Input operator to the operator's argument port. Then, enter _arg in this field. Remember, the value passed using an argument must match a key in your data set.

Adding a Convert Field Operator

In this example, you'll configure a Data Table component to store the account information as a string data type. Then, you'll configure a Data Workflow that converts your Account Value column into a number data type.

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

Configure the Data Table Component

First, you'll configure a Data Table component to store your account data and input it later into a Data Workflow component.

1. In the Module Builder, drag and drop a Dropdown Component IconData Table onto your canvas.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. and Canvas Label Text Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . fields, enter dtAccounts.
3. To the left of the component's configuration window, click Data.
4. In the data table, enter the following:

A

B

C

firstName

certification accountValue

Blair

aws solutions architect

$1000000

JJ

 

$6789.00

Jim

 

1000000

Evan

aws developer

null

Charlotte

aws security

5000000

Amy

aws database

$5439294

Brian

aws machine learning

$178.90

Rupert

null

195.78

Emily

aws networking specialty

nine hundred thousand

5. Click Save & Close.

A static image displaying the Data Table component's completed configuration in the configuration window.

Configure the Data Workflow Component

Next, configure a Data Workflow component to convert the accountValue column into a number data type. First, use an Input operator to bring in the data. Then, use a Convert Field operator with the Cast To field set to Number. Later you'll include two Console operators so you can view what your data looks like before and after the conversion.

1. Drag and drop a Data Workflow onto your canvas, placing it below the Dropdown Component IconData Table component.
2. In the Canvas Label Text Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . and Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. fields, enter dwfConvertFieldNumber.

Configure the Input Operator

1. Drag and drop an Input operator onto your Data Workflow canvas.
2. Configure the 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 operator's Info window as follows:

Setting

Value

Category

Console

Label

Before

3. Connect the output port (right) of the dtAccountsInput operator to the input port (left) of the BeforeConsole operator.

Configure the Convert Field Operator

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

Setting

Value

Category

Convert To

Label

Convert accountValue to Number

Cast To

Number

Keys

accountValue

3. Connect the output port (right) of the dtAccountsInput operator to the input port (left) of the Convert accountValue to NumberConvert Field operator.

Configure the Second Console Operator

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

Setting

Value

Category

Console

Label

After

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

Here's how the completed Data Workflow looks:

A static image displaying the Data Workflow component's completed configuration in the configuration window.

Configure the Button Component

Lastly, add a Button component to trigger the Data Workflow and convert the data type of accountValue column.

1. Drag and drop a Button component Icon Button component onto your canvas, placing it between your Dropdown Component IconData Table and Data Workflow components.
2. In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter btnConvert.
3. In the Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. field, enter Convert to Number.
4. To the left of the component's configuration window, click Actions Icon Actions.
5. Set the Action Type as Event.
6. From the On Click drop-down, select dwfConvertFieldNumber.

A static image displaying the Button component's completed configuration in the configuration window.

7. Click Save & Close.
8. Save your module.

Below is the completed configuration in the Module Builder:

A static image displaying the completed configuration in the Module Builder.

Preview your module in Express View Express View is how your end-user views your application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View. and open the DevTools Console The DevTools Console helps you securely store, build, test, and deploy your software.. Click the button and run the Angular command The Angular command, or data command, is a tool that displays submission data in a browser's developer console. In Express View, enter the following command in the devtool console: angular.element('.unqorkio-form').scope().submission. Now, expand the data in your Before Console operator, you'll see the data as you entered it into your Data Table component. Expand the data in your After Console operator and you'll see that your account values have been converted to numbers. Remember, NaN means Not a Number, and you'll see this anywhere your original data included non-numerical characters.

A static image displaying the data returned in the DevTools Console in Express View.