# How to Sum text setting.

**URL:** <https://forum.kintone.dev/t/how-to-sum-text-setting/388>\
**Category:** General\
**Created:** [November 9, 2020, 6:16am UTC](https://forum.kintone.dev/t/how-to-sum-text-setting/388 "2020-11-09T06:16:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [November 9, 2020, 6:16am UTC](https://forum.kintone.dev/t/how-to-sum-text-setting/388/1 "2020-11-09T06:16:14Z")

</div>

Dear dev team,

i have a 2 text setting and have a value below:

&nbsp;\*text setting1:&nbsp; 5

&nbsp;\*text setting2:&nbsp; 4

and i want SUM 2 field above.

please me.

&nbsp;

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [November 10, 2020, 12:29am UTC](https://forum.kintone.dev/t/how-to-sum-text-setting/388/2 "2020-11-10T00:29:55Z")

</div>

Hello Yoshida-san,

The following is an example code of when you want to add values in two text fields and input the sum of them into the third text field.

Field Code:  
Text 1 = A  
Text 2 = B  
Text 3 = SUM

```
(function () {
"use strict";
kintone.events.on(['app.record.create.submit', 'app.record.edit.submit'], function (event){
var record = event.record;
var Text1 = Number(record['A'].value);
var Text2 = Number(record['B'].value);
var subTotal = Text1 + Text2;

record['SUM'].value = subTotal;

return event;
});})();

```

I think the key here is to add Number() on the text field value that you want to add,  
so the value inside the text field will be treated as number.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [November 10, 2020, 1:02am UTC](https://forum.kintone.dev/t/how-to-sum-text-setting/388/3 "2020-11-10T01:02:01Z")

</div>

thanks you, Because i think a char cannot Sum together. i need two create a code to check content, thanks you.
