# 2 msg.topic in calculation function node

**URL:** <https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526>\
**Category:** General\
**Created:** [3 November 2018 13:14 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526 "2018-11-03T13:14:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [3 November 2018 13:14 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/1 "2018-11-03T13:14:40Z")

</div>

i am trying to make a calculation in a function node with 2 input msg.topic value's.  
can sombody tell me wath i am doing wrong.

```auto
[{&quot;id&quot;:&quot;6cbfa85e.a749a8&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;true&quot;,&quot;x&quot;:570,&quot;y&quot;:140,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;a3818b6a.0226e8&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;gekozen dim percentage&quot;,&quot;func&quot;:&quot;msg.payload = 100 - (msg.payload);\nmsg.topic = \&quot;procent2\&quot;;\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:590,&quot;y&quot;:320,&quot;wires&quot;:[[&quot;e32ad161.289ea&quot;,&quot;55d05e31.bcfa7&quot;]]},{&quot;id&quot;:&quot;e32ad161.289ea&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;true&quot;,&quot;x&quot;:890,&quot;y&quot;:320,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;55d05e31.bcfa7&quot;,&quot;type&quot;:&quot;function&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;r waarde&quot;,&quot;func&quot;:&quot;val1 = msg.r1\nval2 = msg.procent2\n\nmsg.payload = val2 / 100 * val1;\nmsg.topic = \&quot;r\&quot;;\nreturn msg;&quot;,&quot;outputs&quot;:1,&quot;noerr&quot;:0,&quot;x&quot;:640,&quot;y&quot;:220,&quot;wires&quot;:[[&quot;701e536.6d647ac&quot;]]},{&quot;id&quot;:&quot;701e536.6d647ac&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;true&quot;,&quot;x&quot;:890,&quot;y&quot;:140,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;4f36d145.d98a4&quot;,&quot;type&quot;:&quot;ui_slider&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;label&quot;:&quot;Dimmer&quot;,&quot;group&quot;:&quot;fca18ac4.088f68&quot;,&quot;order&quot;:4,&quot;width&quot;:&quot;6&quot;,&quot;height&quot;:&quot;1&quot;,&quot;passthru&quot;:true,&quot;topic&quot;:&quot;procent&quot;,&quot;min&quot;:&quot;0&quot;,&quot;max&quot;:&quot;100&quot;,&quot;step&quot;:&quot;2&quot;,&quot;x&quot;:380,&quot;y&quot;:320,&quot;wires&quot;:[[&quot;928022ac.2d3ec&quot;,&quot;a3818b6a.0226e8&quot;]]},{&quot;id&quot;:&quot;928022ac.2d3ec&quot;,&quot;type&quot;:&quot;debug&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;active&quot;:true,&quot;tosidebar&quot;:true,&quot;console&quot;:false,&quot;tostatus&quot;:false,&quot;complete&quot;:&quot;true&quot;,&quot;x&quot;:390,&quot;y&quot;:260,&quot;wires&quot;:[]},{&quot;id&quot;:&quot;958278b7.d96368&quot;,&quot;type&quot;:&quot;ui_numeric&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;label&quot;:&quot;&quot;,&quot;group&quot;:&quot;fca18ac4.088f68&quot;,&quot;order&quot;:6,&quot;width&quot;:&quot;2&quot;,&quot;height&quot;:&quot;1&quot;,&quot;passthru&quot;:true,&quot;topic&quot;:&quot;r1&quot;,&quot;format&quot;:&quot;{{value}}&quot;,&quot;min&quot;:&quot;0&quot;,&quot;max&quot;:&quot;255&quot;,&quot;step&quot;:&quot;5&quot;,&quot;x&quot;:400,&quot;y&quot;:220,&quot;wires&quot;:[[&quot;55d05e31.bcfa7&quot;,&quot;6cbfa85e.a749a8&quot;]]},{&quot;id&quot;:&quot;aecd66cc.eb29c8&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;255&quot;,&quot;payloadType&quot;:&quot;num&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;onceDelay&quot;:0.1,&quot;x&quot;:190,&quot;y&quot;:220,&quot;wires&quot;:[[&quot;958278b7.d96368&quot;]]},{&quot;id&quot;:&quot;afbd0522.4334c8&quot;,&quot;type&quot;:&quot;inject&quot;,&quot;z&quot;:&quot;d5546796.194978&quot;,&quot;name&quot;:&quot;&quot;,&quot;topic&quot;:&quot;&quot;,&quot;payload&quot;:&quot;20&quot;,&quot;payloadType&quot;:&quot;num&quot;,&quot;repeat&quot;:&quot;&quot;,&quot;crontab&quot;:&quot;&quot;,&quot;once&quot;:false,&quot;onceDelay&quot;:0.1,&quot;x&quot;:170,&quot;y&quot;:320,&quot;wires&quot;:[[&quot;4f36d145.d98a4&quot;]]},{&quot;id&quot;:&quot;fca18ac4.088f68&quot;,&quot;type&quot;:&quot;ui_group&quot;,&quot;z&quot;:&quot;&quot;,&quot;name&quot;:&quot;H801&quot;,&quot;tab&quot;:&quot;92b25a8d.c33e18&quot;,&quot;order&quot;:1,&quot;disp&quot;:true,&quot;width&quot;:&quot;6&quot;},{&quot;id&quot;:&quot;92b25a8d.c33e18&quot;,&quot;type&quot;:&quot;ui_tab&quot;,&quot;z&quot;:&quot;&quot;,&quot;name&quot;:&quot;Test&quot;,&quot;icon&quot;:&quot;dashboard&quot;,&quot;order&quot;:4}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2018 13:42 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/2 "2018-11-03T13:42:21Z")

</div>

> [@nick](#):
>
> can sombody tell me wath i am doing wrong.

Well the first mistake you have made (actually the last I suppose) is that you haven't put a line before the pasted flow containing just three backtick characters, nor have you put another such line after the flow. Without those we cannot import your flow.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 November 2018 13:57 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/3 "2018-11-03T13:57:28Z")

</div>

In the second change node (outgoing) on the 'to' get rid of the period before payload

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [3 November 2018 14:27 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/4 "2018-11-03T14:27:06Z")

</div>

so wat i want to do make a calculation.

val1 = msg.payload.r1  
val2 = msg.payload.procent2

msg.payload = val2 / 100 \* val1;  
msg.payload = "r";  
return msg;

val1 and val2 are both connected to the input of the function node

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2018 14:40 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/5 "2018-11-03T14:40:09Z")

</div>

You have not said what is not working and what is, and you still haven't allowed us to import your flow.

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [3 November 2018 14:47 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/6 "2018-11-03T14:47:05Z")

</div>

can you impot it like this? if you can the problem that i have is that the calculation in the function node r waarde is not working.

```auto
[

{

&quot;id&quot;: &quot;6cbfa85e.a749a8&quot;,

&quot;type&quot;: &quot;debug&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;active&quot;: true,

&quot;tosidebar&quot;: true,

&quot;console&quot;: false,

&quot;tostatus&quot;: false,

&quot;complete&quot;: &quot;true&quot;,

&quot;x&quot;: 570,

&quot;y&quot;: 140,

&quot;wires&quot;: []

},

{

&quot;id&quot;: &quot;a3818b6a.0226e8&quot;,

&quot;type&quot;: &quot;function&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;gekozen dim percentage&quot;,

&quot;func&quot;: &quot;msg.payload = 100 - (msg.payload);\nmsg.topic = \&quot;procent2\&quot;;\nreturn msg;&quot;,

&quot;outputs&quot;: 1,

&quot;noerr&quot;: 0,

&quot;x&quot;: 590,

&quot;y&quot;: 320,

&quot;wires&quot;: [

[

&quot;e32ad161.289ea&quot;,

&quot;55d05e31.bcfa7&quot;

]

]

},

{

&quot;id&quot;: &quot;e32ad161.289ea&quot;,

&quot;type&quot;: &quot;debug&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;active&quot;: true,

&quot;tosidebar&quot;: true,

&quot;console&quot;: false,

&quot;tostatus&quot;: false,

&quot;complete&quot;: &quot;true&quot;,

&quot;x&quot;: 890,

&quot;y&quot;: 320,

&quot;wires&quot;: []

},

{

&quot;id&quot;: &quot;55d05e31.bcfa7&quot;,

&quot;type&quot;: &quot;function&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;r waarde&quot;,

&quot;func&quot;: &quot;val1 = msg.r1\nval2 = msg.procent2\n\nmsg.payload = val2 / 100 * val1;\nmsg.topic = \&quot;r\&quot;;\nreturn msg;&quot;,

&quot;outputs&quot;: 1,

&quot;noerr&quot;: 0,

&quot;x&quot;: 640,

&quot;y&quot;: 220,

&quot;wires&quot;: [

[

&quot;701e536.6d647ac&quot;

]

]

},

{

&quot;id&quot;: &quot;701e536.6d647ac&quot;,

&quot;type&quot;: &quot;debug&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;active&quot;: true,

&quot;tosidebar&quot;: true,

&quot;console&quot;: false,

&quot;tostatus&quot;: false,

&quot;complete&quot;: &quot;true&quot;,

  &quot;x&quot;: 890,

&quot;y&quot;: 140,

&quot;wires&quot;: []

},

{

&quot;id&quot;: &quot;4f36d145.d98a4&quot;,

&quot;type&quot;: &quot;ui_slider&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;label&quot;: &quot;Dimmer&quot;,

&quot;group&quot;: &quot;fca18ac4.088f68&quot;,

&quot;order&quot;: 4,

&quot;width&quot;: &quot;6&quot;,

&quot;height&quot;: &quot;1&quot;,

&quot;passthru&quot;: true,

&quot;topic&quot;: &quot;procent&quot;,

&quot;min&quot;: &quot;0&quot;,

&quot;max&quot;: &quot;100&quot;,

&quot;step&quot;: &quot;2&quot;,

&quot;x&quot;: 380,

&quot;y&quot;: 320,

&quot;wires&quot;: [

[

&quot;928022ac.2d3ec&quot;,

&quot;a3818b6a.0226e8&quot;

]

]

},

{

&quot;id&quot;: &quot;928022ac.2d3ec&quot;,

&quot;type&quot;: &quot;debug&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;active&quot;: true,

&quot;tosidebar&quot;: true,

&quot;console&quot;: false,

&quot;tostatus&quot;: false,

&quot;complete&quot;: &quot;true&quot;,

&quot;x&quot;: 390,

&quot;y&quot;: 260,

&quot;wires&quot;: []

},

{

&quot;id&quot;: &quot;958278b7.d96368&quot;,

&quot;type&quot;: &quot;ui_numeric&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;label&quot;: &quot;&quot;,

&quot;group&quot;: &quot;fca18ac4.088f68&quot;,

&quot;order&quot;: 6,

&quot;width&quot;: &quot;2&quot;,

&quot;height&quot;: &quot;1&quot;,

&quot;passthru&quot;: true,

&quot;topic&quot;: &quot;r1&quot;,

&quot;format&quot;: &quot;{{value}}&quot;,

&quot;min&quot;: &quot;0&quot;,

&quot;max&quot;: &quot;255&quot;,

&quot;step&quot;: &quot;5&quot;,

&quot;x&quot;: 400,

&quot;y&quot;: 220,

&quot;wires&quot;: [

[

&quot;55d05e31.bcfa7&quot;,

&quot;6cbfa85e.a749a8&quot;

]

]

},

{

&quot;id&quot;: &quot;aecd66cc.eb29c8&quot;,

&quot;type&quot;: &quot;inject&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;topic&quot;: &quot;&quot;,

&quot;payload&quot;: &quot;255&quot;,

&quot;payloadType&quot;: &quot;num&quot;,

&quot;repeat&quot;: &quot;&quot;,

&quot;crontab&quot;: &quot;&quot;,

&quot;once&quot;: false,

&quot;onceDelay&quot;: 0.1,

&quot;x&quot;: 190,

&quot;y&quot;: 220,

&quot;wires&quot;: [

[

&quot;958278b7.d96368&quot;

]

]

},

{

&quot;id&quot;: &quot;afbd0522.4334c8&quot;,

&quot;type&quot;: &quot;inject&quot;,

&quot;z&quot;: &quot;d5546796.194978&quot;,

&quot;name&quot;: &quot;&quot;,

&quot;topic&quot;: &quot;&quot;,

&quot;payload&quot;: &quot;20&quot;,

&quot;payloadType&quot;: &quot;num&quot;,

&quot;repeat&quot;: &quot;&quot;,

&quot;crontab&quot;: &quot;&quot;,

&quot;once&quot;: false,

&quot;onceDelay&quot;: 0.1,

&quot;x&quot;: 170,

&quot;y&quot;: 320,

&quot;wires&quot;: [

[

&quot;4f36d145.d98a4&quot;

]

]

},

{

&quot;id&quot;: &quot;fca18ac4.088f68&quot;,

&quot;type&quot;: &quot;ui_group&quot;,

&quot;z&quot;: &quot;&quot;,

&quot;name&quot;: &quot;H801&quot;,

&quot;tab&quot;: &quot;92b25a8d.c33e18&quot;,

&quot;order&quot;: 1,

&quot;disp&quot;: true,

&quot;width&quot;: &quot;6&quot;

},

{

 &quot;id&quot;: &quot;92b25a8d.c33e18&quot;,

&quot;type&quot;: &quot;ui_tab&quot;,

&quot;z&quot;: &quot;&quot;,

&quot;name&quot;: &quot;Test&quot;,

&quot;icon&quot;: &quot;dashboard&quot;,

&quot;order&quot;: 4

}

]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2018 14:58 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/7 "2018-11-03T14:58:35Z")

</div>

I managed to get enough to see what is going on. I presume, though you have not said, that you don't know where the backtick character is on your keyboard otherwise you would just have done as I asked. On a UK English keyboard it is in the top left corner. If you google for  
backtick US Keyboard  
or whatever your keyboard is then I expect it will show you.  
The problem is that you are using msg.r1 and msg.procent and am sending in two messages, neither of which have msg.r1 or msg.procent. One has r1 in msg.topic and the other has procent as the topic. First you need to combine the two messages together so you can get at both values. You can do this using a Join node in key/value pair mode. Then the values will be in msg.payload.r1 and msg.payload.procent (which is what you said in the post above, but not what is in the flow).

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 November 2018 15:06 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/8 "2018-11-03T15:06:06Z")

</div>

@nick - Do you realize the first flow you posted is not the same as the second?

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [3 November 2018 15:07 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/9 "2018-11-03T15:07:13Z")

</div>

yes, i added 2 inject nodes

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 November 2018 15:11 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/10 "2018-11-03T15:11:47Z")

</div>

You need to edit the post with the second flow and put the three back tic's ``` before and after it. As it is, it can not be imported.

You should also do that for the first flow you posted.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 November 2018 15:18 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/12 "2018-11-03T15:18:14Z")

</div>

Almost... the backticks must be on a line of their own. Regardless, the flow itself is already badly formatted from wherever you copied it from. Go back and edit your previous posts to add the backticks. Do not add another post.

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [3 November 2018 15:34 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/13 "2018-11-03T15:34:37Z")

</div>

```auto
[{"id":"6cbfa85e.a749a8","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":140,"wires":[]},{"id":"a3818b6a.0226e8","type":"function","z":"d5546796.194978","name":"gekozen dim percentage","func":"msg.payload = 100 - (msg.payload);\nmsg.topic = \"procent2\";\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":320,"wires":[["e32ad161.289ea","55d05e31.bcfa7"]]},{"id":"e32ad161.289ea","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":320,"wires":[]},{"id":"55d05e31.bcfa7","type":"function","z":"d5546796.194978","name":"r waarde","func":"val1 = msg.r1\nval2 = msg.procent2\n\nmsg.payload = val2 / 100 * val1;\nmsg.topic = \"r\";\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":220,"wires":[["701e536.6d647ac"]]},{"id":"701e536.6d647ac","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":140,"wires":[]},{"id":"4f36d145.d98a4","type":"ui_slider","z":"d5546796.194978","name":"","label":"Dimmer","group":"fca18ac4.088f68","order":4,"width":"6","height":"1","passthru":true,"topic":"procent","min":"0","max":"100","step":"2","x":380,"y":320,"wires":[["928022ac.2d3ec","a3818b6a.0226e8"]]},{"id":"928022ac.2d3ec","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":390,"y":260,"wires":[]},{"id":"958278b7.d96368","type":"ui_numeric","z":"d5546796.194978","name":"","label":"","group":"fca18ac4.088f68","order":6,"width":"2","height":"1","passthru":true,"topic":"r1","format":"{{value}}","min":"0","max":"255","step":"5","x":400,"y":220,"wires":[["55d05e31.bcfa7","6cbfa85e.a749a8"]]},{"id":"aecd66cc.eb29c8","type":"inject","z":"d5546796.194978","name":"","topic":"","payload":"255","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":220,"wires":[["958278b7.d96368"]]},{"id":"afbd0522.4334c8","type":"inject","z":"d5546796.194978","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":320,"wires":[["4f36d145.d98a4"]]},{"id":"fca18ac4.088f68","type":"ui_group","z":"","name":"H801","tab":"92b25a8d.c33e18","order":1,"disp":true,"width":"6"},{"id":"92b25a8d.c33e18","type":"ui_tab","z":"","name":"Test","icon":"dashboard","order":4}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 November 2018 15:38 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/14 "2018-11-03T15:38:38Z")

</div>

What did you not understand about "Go back and edit your previous posts to add the backticks. Do not add another post."?

Whatever, I have already pointed out the basic problem with your flow but you do not appear to have taken any notice. As I said, you need to merge the messages with a Join node. Go back and read my post and ask if you don't understand.

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [22 November 2018 17:53 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/15 "2018-11-22T17:53:17Z")

</div>

hi Colin,

i tried and i tried but i can not make it to work.  
can you please show me?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [22 November 2018 18:14 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/16 "2018-11-22T18:14:01Z")

</div>

Post your updated flow that contains the node that @colin suggested.

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [22 November 2018 18:22 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/17 "2018-11-22T18:22:24Z")

</div>

`[{"id":"6cbfa85e.a749a8","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":140,"wires":[]},{"id":"a3818b6a.0226e8","type":"function","z":"d5546796.194978","name":"gekozen dim percentage","func":"msg.payload = 100 - (msg.payload);\nmsg.topic = \"procent2\";\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":320,"wires":[["e3475f55.c03fa"]]},{"id":"e32ad161.289ea","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":320,"wires":[]},{"id":"55d05e31.bcfa7","type":"function","z":"d5546796.194978","name":"r waarde","func":"val1 = msg.r1\nval2 = msg.procent2\n\nmsg.payload = val2 / 100 * val1;\nmsg.topic = \"r\";\nreturn msg;","outputs":1,"noerr":0,"x":860,"y":220,"wires":[["701e536.6d647ac"]]},{"id":"701e536.6d647ac","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":140,"wires":[]},{"id":"4f36d145.d98a4","type":"ui_slider","z":"d5546796.194978","name":"","label":"Dimmer","group":"fca18ac4.088f68","order":4,"width":"6","height":"1","passthru":true,"topic":"procent","min":"0","max":"100","step":"2","x":380,"y":320,"wires":[["928022ac.2d3ec","a3818b6a.0226e8"]]},{"id":"928022ac.2d3ec","type":"debug","z":"d5546796.194978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":390,"y":260,"wires":[]},{"id":"958278b7.d96368","type":"ui_numeric","z":"d5546796.194978","name":"","label":"","group":"fca18ac4.088f68","order":6,"width":"2","height":"1","passthru":true,"topic":"r1","format":"{{value}}","min":"0","max":"255","step":"5","x":400,"y":220,"wires":[["6cbfa85e.a749a8","e3475f55.c03fa"]]},{"id":"aecd66cc.eb29c8","type":"inject","z":"d5546796.194978","name":"","topic":"","payload":"255","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":220,"wires":[["958278b7.d96368"]]},{"id":"afbd0522.4334c8","type":"inject","z":"d5546796.194978","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":320,"wires":[["4f36d145.d98a4"]]},{"id":"e3475f55.c03fa","type":"join","z":"d5546796.194978","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":700,"y":220,"wires":[["55d05e31.bcfa7","e32ad161.289ea"]]},{"id":"fca18ac4.088f68","type":"ui_group","z":"","name":"H801","tab":"92b25a8d.c33e18","order":1,"disp":true,"width":"6"},{"id":"92b25a8d.c33e18","type":"ui_tab","z":"","name":"Test","icon":"dashboard","order":4}]`

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 November 2018 20:45 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/18 "2018-11-22T20:45:05Z")

</div>

In a previous post I said

> [@Colin](#):
>
> You can do this using a Join node in key/value pair mode.

That is not the mode that you have selected in the Join node.

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [24 November 2018 12:14 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/19 "2018-11-24T12:14:58Z")

</div>

![20181124_131046](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5fb856fa61c1a456b325f396d06b60b0cbbd1dc8.jpeg)

well the main problem is that i can not see what i select

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [24 November 2018 13:17 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/20 "2018-11-24T13:17:41Z")

</div>

What version of node-red are you using?

---

<div class="post-metadata">

**Author:** ![nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@nick](https://discourse.nodered.org/u/nick)\
**Post date:** [24 November 2018 13:29 UTC](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526/21 "2018-11-24T13:29:05Z")

</div>

version: v0.19.3

[Next page](https://discourse.nodered.org/t/2-msg-topic-in-calculation-function-node/4526.md?page=2)
