# Sum in the same field

**URL:** <https://community.n8n.io/t/sum-in-the-same-field/13448>\
**Category:** Questions\
**Tags:** data-transformation, node, expressions, set\
**Created:** [April 26, 2022, 6:37am UTC](https://community.n8n.io/t/sum-in-the-same-field/13448 "2022-04-26T06:37:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![admdiegolima](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/admdiegolima/32/33441_2.png) [@admdiegolima](https://community.n8n.io/u/admdiegolima)\
**Post date:** [April 26, 2022, 6:37am UTC](https://community.n8n.io/t/sum-in-the-same-field/13448/1 "2022-04-26T06:37:11Z")

</div>

In a “SET” node how can I make a sum like this:

Current field = Current field + 1 ?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [April 27, 2022, 7:21am UTC](https://community.n8n.io/t/sum-in-the-same-field/13448/2 "2022-04-27T07:21:59Z")

</div>

Hey @admdiegolima, welcome to the community 🎉

The exact approach would differ slightly on how your input data exactly looks like. But assuming it’s a number (and not a text looking like a number), you could use an [expression](https://docs.n8n.io/nodes/expressions/expressions.html) like `{{ $json["myInputField"] + 1 }}`. Here’s a workflow showing this:

Hope this helps!

---

<div class="post-metadata">

**Author:** ![admdiegolima](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/admdiegolima/32/33441_2.png) [@admdiegolima](https://community.n8n.io/u/admdiegolima)\
**Post date:** [April 27, 2022, 3:46pm UTC](https://community.n8n.io/t/sum-in-the-same-field/13448/3 "2022-04-27T15:46:32Z")

</div>

I’m new here in the community, I don’t know if I’ll be able to express myself well.

My problem is the following:

I make a request in a system called “Management Click” they send the information per page, and each page comes with 20 lines of data, I want to make a flow that after it receives the 20 lines of data it goes back to the beginning and change the variable “page” to +1

---

<div class="post-metadata">

**Author:** ![admdiegolima](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/admdiegolima/32/33441_2.png) [@admdiegolima](https://community.n8n.io/u/admdiegolima)\
**Post date:** [April 28, 2022, 7:37pm UTC](https://community.n8n.io/t/sum-in-the-same-field/13448/4 "2022-04-28T19:37:47Z")

</div>

I’m new here in the community, I don’t know if I’ll be able to express myself well.

My problem is the following:

I make a request in a system called “Management Click” they send the information per page, and each page comes with 20 lines of data, I want to make a flow that after it receives the 20 lines of data it goes back to the beginning and change the variable “page” to +1

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [April 29, 2022, 7:03am UTC](https://community.n8n.io/t/sum-in-the-same-field/13448/5 "2022-04-29T07:03:06Z")

</div>

Ah, so you simply want to implement pagination @admdiegolima? The exact approach will depend on the API you are using but here’s a basic example workflow showing this for the [https://reqres.in/api/users](https://reqres.in/api/users) API:

The HTTP Request node uses an expression to check if we have a `next_page` value (and if we don’t have that value yet, simply use 1 instead):

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/5/5fdabbed1161729a8b3f483ed0bbf45d7c4803a8.png)

The IF node then checks if there are more pages to process by comparing the current page number with the number of total pages received from the API. This is something you’d most likely need to adjust depending on how your API responds.

The Set node will then add 1 to the current page value whenever it runs using an expression like this:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/e/e724639a963805edd8802bf0323dc145b90ac116.png)

Let me know if you have any questions on this.
