JOIN node behavior in manual mode

I want to use the attached flow to join the payloads (into an array) from the incoming messages until the point I force the completion by pressing an inject node.

This is the expected behavior of the join node:

"If a message is received with the msg.complete property set, the output message is sent."

and also

"The other properties of the output message are taken from the last message received before the result is sent."

So the point is that the join node will add to the array the msg.payload from my control message. This is not desirable for my flow. This happens even if I delete the msg.payload from the last message (the control message with msg.complete property), which results in the join node addding the nulll vallue. I could post process the array to remove this extra property but I wonder if this additional step could be avoided.

[{"id":"d154b6e0.a44d38","type":"tab","label":"11-June-2018","disabled":false,"info":""},{"id":"a8c9ec20.a4c3b","type":"inject","z":"d154b6e0.a44d38","name":"","topic":"sensor1","payload":"9","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":111,"y":80,"wires":[["b92383bd.62688"]]},{"id":"b92383bd.62688","type":"function","z":"d154b6e0.a44d38","name":"Format sensor output","func":"let value = Math.floor(Math.random() * msg.payload + 1)\nmsg.payload = {[msg.topic] : value};\ndelete msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":341.0000686645508,"y":158.99999904632568,"wires":[["bebd4f68.b1375"]]},{"id":"a52b7ca4.3f41e","type":"inject","z":"d154b6e0.a44d38","name":"","topic":"sensor2","payload":"9","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108.89999771118164,"y":133.99999523162842,"wires":[["b92383bd.62688"]]},{"id":"bf79a593.678698","type":"inject","z":"d154b6e0.a44d38","name":"","topic":"sensor3","payload":"9","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108.89999771118164,"y":185.99999523162842,"wires":[["b92383bd.62688"]]},{"id":"a6fda1e0.4dfe8","type":"inject","z":"d154b6e0.a44d38","name":"","topic":"sensor4","payload":"9","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":104.89999771118164,"y":236.99999523162842,"wires":[["b92383bd.62688"]]},{"id":"9506641.a171898","type":"debug","z":"d154b6e0.a44d38","name":"All events","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":657.8000087738037,"y":205.00000190734863,"wires":[]},{"id":"bebd4f68.b1375","type":"join","z":"d154b6e0.a44d38","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":514.9000549316406,"y":204.00000381469727,"wires":[["9506641.a171898"]]},{"id":"535ee43e.15354c","type":"inject","z":"d154b6e0.a44d38","name":"Force Completion","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":129,"y":308,"wires":[["cb6d8862.2c1c68"]]},{"id":"cb6d8862.2c1c68","type":"change","z":"d154b6e0.a44d38","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"complete","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":339.1000061035156,"y":243.00000762939453,"wires":[["bebd4f68.b1375","192ad5fc.216e4a"]]},{"id":"192ad5fc.216e4a","type":"debug","z":"d154b6e0.a44d38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":564.1000366210938,"y":280,"wires":[]}]

Output from debug:

forum-01

Flow:

So you would like to send a msg.complete=true (without a payload) and NOT have it add the (null) payload to the array of joined values? Sounds reasonable… and like a bug.

1 Like

Hmm - yeah actually that does look like a bug… it does do the correct thing in merged object mode - but for an array indeed it adds a null when it’s not wanted.
Happy for you to raise an Issue on the main project issues on github.

I had a similar problem with the Join-node while getting data from a database, my problem was, that sometimes the Join Node don t join all payloads, so I decided to set a msg.complete to the last message I want to join, and after that everything works fine