# How to convert a value to a field in an object & set the value as null

**URL:** https://community.synatic.com/t/how-to-convert-a-value-to-a-field-in-an-object-set-the-value-as-null/168
**Category:** Calculators
**Tags:** calculator, helper-functions
**Created:** [January 14, 2022, 4:52pm UTC](https://community.synatic.com/t/how-to-convert-a-value-to-a-field-in-an-object-set-the-value-as-null/168 "2022-01-14T16:52:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![navessa](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/navessa/32/58_2.png) [@navessa](https://community.synatic.com/u/navessa)
#### Post date: [January 14, 2022, 4:52pm UTC](https://community.synatic.com/t/how-to-convert-a-value-to-a-field-in-an-object-set-the-value-as-null/168/1 "2022-01-14T16:52:21Z")

</div>

The below image is an example of a flow where a Record Generator step is used as a source step.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/f5f680b3931613fbc6e1057601bbd3564e0e2ca0.png)

In the Record Generator step, it is populated with a data load as per the image below.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/ddedde34f174c5cc2d81b1b3435ada2c8226112a.png)

Illustrated in the image below is the output of the data load when testing the Record Generator step.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/ae7c6695a58beada0a35a2cebc3a8dbdc5f87f11.png)

The image below contains the code in the calculator step that is used to convert a value to a field in an object and to set the value as a null.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/e060386cff00adc86ca97c9a910f7c06d1985503.png)

Copy and paste the below code in your calculator step:

let inputRecord=input.record;

for (let key in inputRecord.result) {  
let obj = inputRecord.result[key];

let value = obj[“full\_field\_key”];  
obj[value] = null;

delete obj[“full\_field\_key”];  
}

return inputRecord;

The below image is the output/ results. Highlighted are the new fields that were previously values and their values have been set to null.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/082e3984d19997cda6895aea4f93b05142cb5270.png)
