# Function Node undefined

**URL:** <https://discourse.nodered.org/t/function-node-undefined/29557>\
**Category:** General\
**Created:** [5 July 2020 14:45 UTC](https://discourse.nodered.org/t/function-node-undefined/29557 "2020-07-05T14:45:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvyMike](https://avatars.discourse-cdn.com/v4/letter/i/a5b964/32.png) [@IvyMike](https://discourse.nodered.org/u/IvyMike)\
**Post date:** [5 July 2020 14:45 UTC](https://discourse.nodered.org/t/function-node-undefined/29557/1 "2020-07-05T14:45:45Z")

</div>

Hello im trying to defined the two values that comes from each counter, but there isn´t a topic so the Function doesn´t know which value to use. What i want to do is simple, in the Function node i need to do a simple calculation with the values that comes from the two counters, but i can´t create a variable "var on=payload.counter1 " and "var marcha=payload.counter2".

I created a function where i defined a variable to each payload that comes out of the counter, and then i have a FUNCTION where i try to call the variables of each function but still is undefined.  
Im new in node red, hopefully some of you could help me out!

 ![chrome_qhkYZo4Uo2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de592f921e530f08a1a4050a5aaeb407faa0154c.png)

---

<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:** [5 July 2020 14:51 UTC](https://discourse.nodered.org/t/function-node-undefined/29557/2 "2020-07-05T14:51:05Z")

</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.

---

<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:** [3 September 2020 14:51 UTC](https://discourse.nodered.org/t/function-node-undefined/29557/3 "2020-09-03T14:51:13Z")

</div>

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