# Mathematical formula changes position

**URL:** <https://discourse.nodered.org/t/mathematical-formula-changes-position/33075>\
**Category:** General\
**Created:** [19 September 2020 09:08 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075 "2020-09-19T09:08:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [19 September 2020 09:08 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075/1 "2020-09-19T09:08:11Z")

</div>

Hi again,  
its hard for me to discribe my problem.  
I get this from a modbus flex getter:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8bc2ceb03eaa44546c2e939c0ab9610151a8bb7a.png)

I want to make a easy formula:  
Pverbrauch = Pgesamt - Pein + Pbezug  
but the problem is the topic of Pges & Pein:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/f/afd7769dc56896e5bd9618ee82ec77b81eebc7e8.png)

when I join them:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/f/afaed867c3f8f38a0a74ccaaf85cc3498312510d.png)  
I get a array with topic "0" "1" and "2".

my formula:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/9733c42620aa9c489bd28b4ebccdff522ddd6a1f.png)  
but the topics a switching every day, for example sometimes "Pbez" is 0, sometimes 1, sometimes 2.  
=\> so the formula is wrong sometimes.

How can I get explicit topics for the values ?

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [19 September 2020 09:12 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075/2 "2020-09-19T09:12:45Z")

</div>

sorry, I got my mistake 🤓 after reading my own problem a few times 🤣

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [19 September 2020 09:24 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075/3 "2020-09-19T09:24:48Z")

</div>

solution:  
1.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0fa14590d42312cd4faadefb731e719153c2a681.png)  
define a topic

1. 

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/9/c9ab1991f527d8e9aaec426cae9e411690840bb2.png)  
join as an object

1. 

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/c/2c0874ba4df0e6dbc88653b264a4f2fefaa9e79c.png)  
getting defined values

1. 

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1a17a0277ad5ceab72b8c44226de861249d0b9f.png)  
correct formula

finish 😄

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [19 September 2020 10:34 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075/4 "2020-09-19T10:34:11Z")

</div>

Hi Becker,

I'm glad you shared in detail the solution .. i was wondering where exactly the problem was 😉

Its takes a little time to tweak it at the beginning (with debug nodes everywhere) but once you fully understand it, the join node is one of the most powerful nodes from the core nodes.

---

<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 October 2020 10:34 UTC](https://discourse.nodered.org/t/mathematical-formula-changes-position/33075/5 "2020-10-03T10:34:24Z")

</div>

Closed on 3 October 2020 10:34 UTC

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