# Topic msg for mathematics equation

**URL:** <https://discourse.nodered.org/t/topic-msg-for-mathematics-equation/11938>\
**Category:** General\
**Created:** [7 June 2019 12:36 UTC](https://discourse.nodered.org/t/topic-msg-for-mathematics-equation/11938 "2019-06-07T12:36:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aabbas](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@aabbas](https://discourse.nodered.org/u/aabbas)\
**Post date:** [7 June 2019 12:36 UTC](https://discourse.nodered.org/t/topic-msg-for-mathematics-equation/11938/1 "2019-06-07T12:36:43Z")

</div>

Hi,

I am using the msg topic to make number substraction or sum. Here you have the flow that I am using to make my equation but I get NaN all time. Could you please help me.

```auto
[{"id":"51e16efc.60bc","type":"inject","z":"10870198.997aae","name":"","topic":"T1","payload":"25","payloadType":"num","repeat":"1","crontab":"","once":false,"onceDelay":"","x":220,"y":240,"wires":[["733fb56c.441bec"]]},{"id":"6679dccc.8b7084","type":"debug","z":"10870198.997aae","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":280,"wires":[]},{"id":"f6b2bee9.1dbef","type":"function","z":"10870198.997aae","name":"Subtraction","func":"msg.payload = msg.payload.T2 - msg.payload.T1\nmsg.topic=\"Tf\";\nreturn msg;\n","outputs":1,"noerr":0,"x":610,"y":280,"wires":[["6679dccc.8b7084"]]},{"id":"733fb56c.441bec","type":"function","z":"10870198.997aae","name":"T1","func":"msg.topic=\"T1\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":240,"wires":[["f6b2bee9.1dbef"]]},{"id":"f0a8bd35.2b1dc","type":"inject","z":"10870198.997aae","name":"","topic":"T2","payload":"21","payloadType":"num","repeat":"1","crontab":"","once":false,"onceDelay":"","x":220,"y":300,"wires":[["10bb1e8c.d14f31"]]},{"id":"10bb1e8c.d14f31","type":"function","z":"10870198.997aae","name":"T2","func":"msg.topic=\"T2\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":300,"wires":[["f6b2bee9.1dbef"]]}]

```

---

<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:** [7 June 2019 12:41 UTC](https://discourse.nodered.org/t/topic-msg-for-mathematics-equation/11938/2 "2019-06-07T12:41:42Z")

</div>

Hi @aabbas

you asked almost exactly the same question here: [Substraction 2 msg payload by using topic](https://discourse.nodered.org/t/substraction-2-msg-payload-by-using-topic/10471) and received two replies, neither of which you have replied to.

Please read those responses and continue the discussion in that topic rather than just ask the same question again in a new topic.

---

<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:** [7 June 2019 12:41 UTC](https://discourse.nodered.org/t/topic-msg-for-mathematics-equation/11938/3 "2019-06-07T12:41:56Z")

</div>


