--- title: "How to: Update and Conditionally Update Key/Value Pairs" slug: "create-field-operator-updating-and-conditionally-updating-keyvalue-pairs" updated: 2025-12-23T15:38:36Z published: 2025-12-23T15:38:36Z canonical: "docs.unqork.io/create-field-operator-updating-and-conditionally-updating-keyvalue-pairs" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.unqork.io/llms.txt > Use this file to discover all available pages before exploring further. # How to: Update and Conditionally Update Key/Value Pairs UDesignerClassic Designer The **Create Field operator** doesn’t only create fields. It can also be used to update existing fields Let’s say that a value for a key called `employed` is `true` for every row of the table. But you want to switch the value from `true` to `yes`. Using a simple `employed="yes"` expression updates the value in every row. A second key is called `fullPartTime`, which defines whether the person works full-time or part-time. The two possible values are `partTime` and `full`. But you want your values to be more consistent, so you want to change the `full` value to `fullTime`. So, you’ll use a common conditional expression: `key=IF(condition,valueIfTrue,valueIfFalse)`. For this example, you’ll use the following conditional expression to make the change: `fullPartTime=IF(fullPartTime="full","fullTime",fullPartTime)`. Let's explore the elements of this expression. - The **condition** represents the original key of `fullPartTime` and the value of `full`. - The **valueIfTrue** is the value of `fullTime`, so the value of `full` is replaced with `fullTime`. - The **valueIfFalse** is the key of `fullPartTime`. Meaning, if the value of `fullPartTime` is not `full`, then ignore it. That way, the `partTime` values are left alone. ## Configuration In this how-to guide, you'll use the Create Field operator to conditionally update existing key/value pairs in a table. ### Configure the Data Table Component First, configure a [Data Table](/v1/docs/data-table-component) component to create the table where you’ll add your key/value pairs. 1. In the Module Builder, drag and drop a **Data Table** component onto your canvas. 2. In the **Property ID** and **Label Text** fields, enter `dtTable`. | name | incomeAnnual | employed | fullPartTime | | --- | --- | --- | --- | | Kris | 36000 | true | partTime | | Yuki | 98500 | true | full | | Graciela | 74000 | true | full | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(554).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 3. Click **Save Component**. ### Configure the Data Workflow Component With the Data Table component set up, you're ready to use the [Create Field](/v1/docs/create-field-operator) operator. First, update the employed key/value pair in every row (object) in your table (array). Then, conditionally update the `fullPartTime` value from `full` to `fullTime`. 1. Drag and drop a **Data Workflow** component onto your canvas, placing it below the Data Table component. 2. In the **Property ID** and **Canvas** **Label Text** fields, enter `dwfCreateField`. #### Configure the Input Operator First, connect your [Data Table](/v1/docs/data-table-component) component to the [Data Workflow](/v1/docs/data-workflow-component) using an [Input](/v1/docs/input-operator) 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 | dtTable | | Required | Yes | | Source | Default | #### Configure the Create Field Operator Next, let's set up the [Create Field](/v1/docs/how-to-guide-create-field-operator) operator. 1. Drag and drop a **Create Field** operator onto your Data Workflow canvas. 2. Configure the operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Create Field | | Label | employment | | Do Not Sanitize Formula | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Checked_Box(7).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) (checked) | | Preserve Argument Type | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/icon_unchecked(1).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) (unchecked) | | Field 1 | employed="yes" | | Field 2 | fullPartTime=IF(fullPartTime="full","fullTime",fullPartTime) | | Field 3 | | | Field 4 | | | Field 5 | | 3. Connect the output port (right) of the `dtTable` **Input** operator to the input port (left) of the `employment` **Create Field** operator. #### Configure the Console Operators Next, you’ll add [Console](/v1/docs/console-operator) operators before and after the [Create Field](/v1/docs/create-field-operator) operator to view the change in data. > You'll notice that the Create Field operator only outputs to a Console operator. When creating applications, you might also want to use a dedicated [Output](/v1/docs/output-operator) operator. Then, you can connect that Output operator to a [Hidden](/v1/docs/hidden-component) component. That way, you can store the final table and reference it elsewhere in your application. 1. Drag and drop two **Console** operators onto your Data Workflow canvas. 2. Configure the first **Console** operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Console | | Label | Before Create Field | 3. Connect the output port (right) of the `dtTable` **Input** operator to the input port (left) of the `Before Create Field` **Console** operator. 4. Configure the second **Console** operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Console | | Label | After Create Field | 5. Connect the output port (right) of the `employment` **Create Field** operator to the input port (left) of the `After Create Field` **Console** operator. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(556).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 6. Click **Save Component**. ### Configure the Button Component Lastly, add a [Button](/v1/docs/how-to-guide-button-component) component to trigger your Data Workflow. 1. Drag and drop a **Button** component onto your canvas, placing it below the Data Workflow component. 2. In the **Property ID** field, enter `btnRunDWF`. 3. In the **Label Text** field, enter `Run Create Field`. 4. From the **Action Type** drop-down, select `Event`. 5. From the **On Click** drop-down, select `dwfCreateField`. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(557).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 6. Click **Save Component**. 7. **Save** your module. Here's how the completed example looks in the Module Builder: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(558).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) Preview your module in Express View and open the DevTools Console. Click the **Run Create Field** button and view the results in the Console: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/assoclp_dwfCreateUpdate_38_CFDexpress_01.gif?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) The **Create Field operator** doesn’t only create fields. It can also be used to update existing fields Let’s say that a value for a key called `employed` is `true` for every row of the table. But you want to switch the value from `true` to `yes`. Using a simple `employed="yes"` expression updates the value in every row. A second key is called `fullPartTime`, which defines whether the person works full-time or part-time. The two possible values are `partTime` and `full`. But you want your values to be more consistent, so you want to change the `full` value to `fullTime`. So, you’ll use a common conditional expression: `key=IF(condition,valueIfTrue,valueIfFalse)`. For this example, you’ll use the following conditional expression to make the change: `fullPartTime=IF(fullPartTime="full","fullTime",fullPartTime)`. Let's explore the elements of this expression. - The **condition** represents the original key of `fullPartTime` and the value of `full`. - The **valueIfTrue** is the value of `fullTime`, so the value of `full` is replaced with `fullTime`. - The **valueIfFalse** is the key of `fullPartTime`. Meaning, if the value of `fullPartTime` is not `full`, then ignore it. That way, the `partTime` values are left alone. ## Configuration In this how-to guide, you'll use the Create Field operator to conditionally update existing key/value pairs in a table. ### Configure the Data Table Component First, configure a [Data Table](/v1/docs/data-table-component) component to create the table where you’ll add your key/value pairs. 1. In the Module Builder, drag and drop a **Data Table** component onto your canvas. 2. In the **Property ID** and **Canvas Label Text** fields, enter `dtTable`. | name | incomeAnnual | employed | fullPartTime | | --- | --- | --- | --- | | Kris | 36000 | true | partTime | | Yuki | 98500 | true | full | | Graciela | 74000 | true | full | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(559).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 3. Click **Save & Close**. ### Configure the Data Workflow Component With the Data Table component set up, you're ready to use the [Create Field](/v1/docs/create-field-operator) operator. First, update the employed key/value pair in every row (object) in your table (array). Then, conditionally update the `fullPartTime` value from `full` to `fullTime`. 1. Drag and drop a **Data Workflow** component onto your canvas, placing it below the Data Table component. 2. In the **Property Name** and **Canvas** **Label Text** fields, enter `dwfCreateField`. #### Configure the Input Operator First, connect your [Data Table](/v1/docs/data-table-component) component to the [Data Workflow](/v1/docs/data-workflow-component) using an [Input](/v1/docs/input-operator) 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 | dtTable | | Required | Yes | | Source | Default | #### Configure the Create Field Operator Next, let's set up the [Create Field](/v1/docs/how-to-guide-create-field-operator) operator. 1. Drag and drop a **Create Field** operator onto your Data Workflow canvas. 2. Configure the operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Create Field | | Label | employment | | Do Not Sanitize Formula | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Checked_Box(7).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) (checked) | | Preserve Argument Type | ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/icon_unchecked(1).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) (unchecked) | | Field 1 | employed="yes" | | Field 2 | fullPartTime=IF(fullPartTime="full","fullTime",fullPartTime) | | Field 3 | | | Field 4 | | | Field 5 | | 3. Connect the output port (right) of the `dtTable` **Input** operator to the input port (left) of the `employment` **Create Field** operator. #### Configure the Console Operators Next, you’ll add [Console](/v1/docs/console-operator) operators before and after the [Create Field](/v1/docs/create-field-operator) operator to view the change in data. > You'll notice that the Create Field operator only outputs to a Console operator. When creating applications, you might also want to use a dedicated [Output](/v1/docs/output-operator) operator. Then, you can connect that Output operator to a [Hidden](/v1/docs/hidden-component) component. That way, you can store the final table and reference it elsewhere in your application. 1. Drag and drop two **Console** operators onto your Data Workflow canvas. 2. Configure the first **Console** operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Console | | Label | Before Create Field | 3. Connect the output port (right) of the `dtTable` **Input** operator to the input port (left) of the `Before Create Field` **Console** operator. 4. Configure the second **Console** operator's **Info** window as follows: | Setting | Value | | --- | --- | | Category | Console | | Label | After Create Field | 5. Connect the output port (right) of the `employment` **Create Field** operator to the input port (left) of the `After Create Field` **Console** operator. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(560).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 6. Click **Save**. ### Configure the Button Component Lastly, add a [Button](/v1/docs/how-to-guide-button-component) component to trigger your Data Workflow. 1. Drag and drop a **Button** component onto your canvas, placing it below the Data Workflow component. 2. In the **Property ID** field, enter `btnRunDWF`. 3. In the **Label Text** field, enter `Run Create Field`. 4. Set the **Action Type** as **Event**. 5. From the **On Click** drop-down, select **dwfCreateField**. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(566).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) 6. Click **Save & Close**. 7. **Save** your module. Here's how the completed example looks in the Module Builder: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/image(562).png?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) Preview your module in Express View and open the DevTools Console. Click the **Run Create Field** button and view the results in the Console: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/assoclp_dwfCreateUpdate_38_CFDexpress_01.gif?sv=2026-02-06&spr=https&st=2026-11-08T10%3A18%3A22Z&se=2026-11-08T11%3A18%3A22Z&sr=c&sp=r&sig=SHMsSiSgBKpgzd9LM2K308JVe64f4Q8YXb4wGyKbzyo%3D) A key-value pair is a fundamental data structure where a unique "key" is associated with a specific "value," used for organizing and retrieving data efficiently, like in dictionaries or databases. An object is a type of data structure that represents a single, self-contained entity that acts as a container for the characteristics of that entity. An array is a type of object that stores one or more data types. Data types supported in arrays include numbers, strings, and objects. In Unqork an application is a program used to perform specific tasks. An application can be one of two types: workflow or module. Triggers activate another component when certain requirements are met. Trigger types include Concurrent, Post, and Error. Some components do not have the ability to trigger others. 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. The DevTools Console helps you securely store, build, test, and deploy your software.