Split and Join and manual join also includes '["

Not sure if its a bug or not, but I'm having an issue with Split and Join. I split apart a message to edit the payload components based on a character "[".

Two separate observations:

  1. If I use automatic join, sometimes the result is corrupted and I get a result of part of message 1 and the other part of message 2, instead of part of message 1 joined back with the other part of message 1.
  2. If I use manual, the join works fine but also concatenated on the single output message.payload from the join is the ch character that was used in the split. For me that is "[".

Can you provide an example flow that shows these cases ?

A way to make a test flow may be too configure an inject node to inject the string (or whatever your input is) and feed that into the node or nodes showing the problem. Then Export those nodes and paste the flow here.

See this post for more how to do that - How to share code or flow json

I "may" have fixed it by changing the join rule to number of message parts to 1. When I had it set to 2 (part.0 + part.1) I was getting the ch char added.

Code and test injects are here...

[{"id":"ba6c3622.ce6758","type":"tab","label":"Join Test","disabled":false,"info":""},{"id":"bbef0ccb.b97248","type":"link in","z":"ba6c3622.ce6758","name":"DogPark Rotor","links":["bd0cd66e.8ce69","5344990e.62b1f","2428135b.8aab5c"],"x":315,"y":1020,"wires":[["51e9912b.3c1b98"]]},{"id":"51e9912b.3c1b98","type":"string","z":"ba6c3622.ce6758","name":"delRight","methods":[{"name":"delRightMost","params":[{"type":"str","value":"]"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":440,"y":1020,"wires":[["bab22fb0.49e14","6dd5ce82.b55f6"]]},{"id":"bab22fb0.49e14","type":"split","z":"ba6c3622.ce6758","name":"","splt":"[","spltType":"str","arraySplt":"2","arraySpltType":"len","stream":false,"addname":"","x":610,"y":1020,"wires":[["db46f5a4.c3db78"]]},{"id":"db46f5a4.c3db78","type":"switch","z":"ba6c3622.ce6758","name":"route","property":"parts.index","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":1180,"wires":[["7a2fd0e6.efde98"],["273db89.d38a5c8"]]},{"id":"7a2fd0e6.efde98","type":"string","z":"ba6c3622.ce6758","name":"getMsgId","methods":[{"name":"getLeftMost","params":[{"type":"str","value":" "}]},{"name":"toInteger","params":[]}],"prop":"payload","propout":"reportMsgId","object":"msg","objectout":"msg","x":560,"y":1140,"wires":[["5572afcb.22b858"]]},{"id":"6dd5ce82.b55f6","type":"debug","z":"ba6c3622.ce6758","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1190,"y":1020,"wires":[]},{"id":"273db89.d38a5c8","type":"string","z":"ba6c3622.ce6758","name":"getPayload","methods":[{"name":"getLeftMost","params":[{"type":"str","value":":"}]},{"name":"trimRight","params":[]}],"prop":"payload","propout":"type","object":"msg","objectout":"msg","x":570,"y":1220,"wires":[["1704ee2c.fac10a"]]},{"id":"5572afcb.22b858","type":"change","z":"ba6c3622.ce6758","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":1140,"wires":[["1010133b.4ffd05"]]},{"id":"1010133b.4ffd05","type":"join","z":"ba6c3622.ce6758","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1030,"y":1120,"wires":[["e4a9af0f.899208"]]},{"id":"1704ee2c.fac10a","type":"string","z":"ba6c3622.ce6758","name":"delLeft","methods":[{"name":"delLeftMost","params":[{"type":"str","value":":"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":810,"y":1220,"wires":[["1010133b.4ffd05"]]},{"id":"e4a9af0f.899208","type":"debug","z":"ba6c3622.ce6758","name":"Manual Join","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1210,"y":1120,"wires":[]},{"id":"a671d340.83dfa","type":"inject","z":"ba6c3622.ce6758","name":"Inject Sat","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"12345678 Test [Sat Radio Report:Down Mhz:435.18000, Down Mode:FM, Up MHz:145.98000, Up Mode:FM]","payloadType":"str","x":360,"y":900,"wires":[["2428135b.8aab5c"]]},{"id":"495fa787.65b808","type":"inject","z":"ba6c3622.ce6758","name":"Inject Radio","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"00000669 Test [Radio Report:RxMHz:7.07400, TxMHz:7.07400, Band:40M, Mode:CW, Power:8]","payloadType":"str","x":370,"y":940,"wires":[["2428135b.8aab5c"]]},{"id":"2428135b.8aab5c","type":"link out","z":"ba6c3622.ce6758","name":"Dogpark UDP Broadcast","links":["283150a.473e93","4a8cc533.a6b02c","68170ff2.47c85","7cd9761d.6c6268","f3e51bbd.479fc","dd7d71e1.c9fca8","abd4ded5.24942","2653cb90.d47ae4","dba74049.648eb8","962cefa1.d43678","bd8f1d12.18b75","3f59b914.1e1bfe","faf74149.41dbd8","88df9653.d8ae68","1df250b8.903d4f","f6bca23b.16c048","83e10ce5.e8e13","f6c74fde.f2b4e","bbef0ccb.b97248"],"x":515,"y":920,"wires":[]},{"id":"ced30019.9d5ea8","type":"comment","z":"ba6c3622.ce6758","name":"Manual Join Ends Up with a \"]\" on the end... but ok since I can remove it.","info":"","x":1250,"y":1080,"wires":[]}]
  • D

:slight_smile: - just out of interest - was is/was the actual end result you are trying to get to... ?
just that string ? or does that then get manipulated further ?

Further.. MacDoppler and MacLogger UDP Streams for amateur radio. I have a function I found which adds the """ around the key values then I have a nice JS object to play with.

  • The msg.type is now set to the type of UDP report.
  • An embedded sequential message id is moved out of the payload so that we can use rule based execution if the payload changes. Leaving it in the object would mean that every object is unique so RBE would be ineffective.
  • Reports are now JS objects instead of strings - Now really easy to switch on flow type and literally zero code reuse in each flow. Even fields that are nums are converted upfront instead of special processing for each report.

v6 is my current iteration...
https://groups.io/g/nodered-hamradio/files/MacDoppler%20to%20Goto%20Telescope%20Mount%20Rotator

Beyond using the spot reports and other stuff I get out of MacDoppler and MacLogger, I wrote a python program to take rotor commands from MacDoppler and drive a goto telescope mount to point antennas at passing satellites. I am now converting this code to Node-Red.

Essentially I have completed the MacDoppler side of the code and am now working on the Telescope code.

The function I have that coverts key:value into quoted key:values works great... Any idea if there is a node that does that? Next step I guess is to write a node if one does not exist.

I have only been doing this for a week but am happy with the results so far.

Heres a pic of satellite tracking... Satellite Tracking using Astronomy Goto Mount |

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