# How to add two function blocks?

**URL:** <https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467>\
**Category:** General\
**Tags:** function-node\
**Created:** [28 June 2022 14:40 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467 "2022-06-28T14:40:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EduardoSodre](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@EduardoSodre](https://discourse.nodered.org/u/EduardoSodre)\
**Post date:** [28 June 2022 14:40 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467/1 "2022-06-28T14:40:43Z")

</div>

Good morning everyone, I have to add two function blocks, can anyone help me?

Here's a print of my problem.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/53907251058ba8d54fca8685630574d081623e17.png)

Thank you for your attention.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 June 2022 14:42 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467/2 "2022-06-28T14:42:25Z")

</div>

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

Once the values are joined in one message, you can access both properties at the same time (in a function or change node etc)

---

<div class="post-metadata">

**Author:** ![EduardoSodre](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@EduardoSodre](https://discourse.nodered.org/u/EduardoSodre)\
**Post date:** [28 June 2022 14:48 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467/3 "2022-06-28T14:48:25Z")

</div>

Maybe I expressed myself wrong, could I add the two values?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 June 2022 15:02 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467/4 "2022-06-28T15:02:10Z")

</div>

> [@EduardoSodre](#):
>
> Maybe I expressed myself wrong

you were not clear but i understood.

> [@EduardoSodre](#):
>
> could I add the two values

Yes. If they are in the same msg (in the same payload)

That's why I pointed you to the JOIN node and said ...

> [@Steve-Mcl](#):
>
> Once the values are joined in one message, you can access both properties at the same time

... meaning you will be able to ADD them together (for example) in a function node

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 August 2022 15:02 UTC](https://discourse.nodered.org/t/how-to-add-two-function-blocks/64467/5 "2022-08-27T15:02:49Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
