# Join node overwrite data

**URL:** https://discourse.nodered.org/t/join-node-overwrite-data/51037
**Category:** General
**Created:** [15 September 2021 01:00 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037 "2021-09-15T01:00:34Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mafify](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mafify](https://discourse.nodered.org/u/mafify)
#### Post date: [15 September 2021 01:00 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/1 "2021-09-15T01:00:34Z")

</div>

The CAN BUS sends data with similar ID. I know that I will receive 29 msgs every 1 minute. I used the Join ID as shown in the picture to join the first 29 msgs in an array. So I can assort them depending on their ID # in the function node.  
For some reason, the data will be overwritten and won't receive the expected order. I added a reset topic after the 29 msgs are received to reset the join node, but it didn't solve it.

The inject node solve it when I manually click it and next batch arrives correctly but connecting the reset node to the front of join node didn't solve it. What I am doing wrong?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/267bc3b36ef56296fee08a6ec83a6f64a204aa4b.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: [15 September 2021 06:56 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/2 "2021-09-15T06:56:10Z")

</div>

> [@mafify](#):
>
> For some reason, the data will be overwritten and won't receive the expected order

In array mode, the items are joined in the order they arrive.

To ensure order is correct, change to `key/value` mode (ensure each value has a unique topic)

---

<div class="post-metadata">

### Author: ![mafify](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mafify](https://discourse.nodered.org/u/mafify)
#### Post date: [15 September 2021 16:28 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/3 "2021-09-15T16:28:54Z")

</div>

If I have unique **key/value** , I wouldn't use the **join node**. I am using it to give unique ID to the 29 coming data streams. The only way is to clear reset the **join node** after it receives a batch of data

---

<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: [15 September 2021 16:49 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/4 "2021-09-15T16:49:20Z")

</div>

Are you certain there is nothing in the `msg` of these 29 items that differentiates them?

All you need to **absolutely**  **ensure** the items after the join node are **always** in the correct order is to generate a `topic` for the `msg` before it enters the join node then use the key/value mode.

Use a debug node with show complete msg set to inspect the full message properties (not just payload)

---

<div class="post-metadata">

### Author: ![mafify](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mafify](https://discourse.nodered.org/u/mafify)
#### Post date: [15 September 2021 17:11 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/5 "2021-09-15T17:11:59Z")

</div>

yes, because CAN BUS send a request followed by another request, sometimes the second request doesn't go through and will only send one msg instead of 29. Maybe that is the reason that when it happens like few times in the day it keep moving the array and will miss one every time.

That's why I added a reset switch node after the join to reset it after it send a packet. It doesn't work unless I inject it by myself.

I think I will the reset with a delay of 50 ms once a msg is sent. I think that will solve that overwrite issue

---

<div class="post-metadata">

### Author: ![mafify](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@mafify](https://discourse.nodered.org/u/mafify)
#### Post date: [15 September 2021 17:35 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/6 "2021-09-15T17:35:02Z")

</div>

That solved the issue. Adding a **reset** with a **delay** before the **Join Node**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f29af36cdd76952f645eb3a5cd90b4f5ad2d94f0.png)

---

<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: [14 November 2021 17:35 UTC](https://discourse.nodered.org/t/join-node-overwrite-data/51037/7 "2021-11-14T17:35:47Z")

</div>

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