# Need help combining flows

**URL:** <https://discourse.nodered.org/t/need-help-combining-flows/41957>\
**Category:** General\
**Created:** [3 March 2021 14:20 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957 "2021-03-03T14:20:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulrischa](https://avatars.discourse-cdn.com/v4/letter/u/e0b2c6/32.png) [@ulrischa](https://discourse.nodered.org/u/ulrischa)\
**Post date:** [3 March 2021 14:20 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/1 "2021-03-03T14:20:46Z")

</div>

Hi I just start with node red. What I want is basically to combie the result of two flows in one string.  
My Flow is here. Joined val does not output anything

```auto
[{"id":"6642db4d.a294f4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"58c50cd5.3a2584","type":"html","z":"6642db4d.a294f4","name":"Lra ffb covid zahlen","property":"payload","outproperty":"payload","tag":".contenttable li","ret":"text","as":"multi","x":190,"y":320,"wires":[["38468fac.0db4e","2f30e56e.1c5c2a"]]},{"id":"5b418e99.f9c01","type":"http request","z":"6642db4d.a294f4","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.lra-ffb.de/aktuelles/corona-informationen/corona-statistik-infizierte-genesene-verstorbene-und-geimpfte-im-landkreis","tls":"","persist":false,"proxy":"","authType":"","x":150,"y":240,"wires":[["58c50cd5.3a2584"]]},{"id":"c2d4e182.ddef5","type":"inject","z":"6642db4d.a294f4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":160,"wires":[["5b418e99.f9c01"]]},{"id":"2f30e56e.1c5c2a","type":"change","z":"6642db4d.a294f4","name":"cov val","rules":[{"t":"set","p":"cov_val","pt":"msg","to":"$split(payload,\": \")[1]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":380,"wires":[["a12ef084.f558e"]]},{"id":"38468fac.0db4e","type":"change","z":"6642db4d.a294f4","name":"cov date","rules":[{"t":"set","p":"topic","pt":"msg","to":"$split(payload,\": \")[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":300,"wires":[["4a3d55b6.fbce2c"]]},{"id":"a958977c.b49378","type":"join","z":"6642db4d.a294f4","name":"joined date","mode":"custom","build":"string","property":"cov_date","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":300,"wires":[["d1f1ec75.f287d"]]},{"id":"4a3d55b6.fbce2c","type":"change","z":"6642db4d.a294f4","name":"","rules":[{"t":"set","p":"cov_date","pt":"msg","to":"\"'\"&topic&\"'\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":300,"wires":[["a958977c.b49378"]]},{"id":"a12ef084.f558e","type":"change","z":"6642db4d.a294f4","name":"","rules":[{"t":"change","p":"cov_val","pt":"msg","from":",","fromt":"str","to":".","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":380,"wires":[["31714c84.2b5f04"]]},{"id":"d1f1ec75.f287d","type":"change","z":"6642db4d.a294f4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"https://quickchart.io/chart?c={type:'bar',data:{labels:[\"&cov_date&\"}}}], datasets:[{label:'Covid',data:[\"&cov_val&\"]}]}}\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":300,"wires":[["bcee2d94.c9c4"]]},{"id":"31714c84.2b5f04","type":"join","z":"6642db4d.a294f4","name":"joined val","mode":"custom","build":"string","property":"cov_val","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":820,"y":380,"wires":[["bcee2d94.c9c4","47dc034f.71cbdc"]]},{"id":"47dc034f.71cbdc","type":"debug","z":"6642db4d.a294f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"cov_val","targetType":"msg","statusVal":"","statusType":"auto","x":1260,"y":440,"wires":[]},{"id":"bcee2d94.c9c4","type":"change","z":"6642db4d.a294f4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"blabla?c={type:'bar',data:{labels:[\"&cov_date&\"}}}], datasets:[{label:'Covid',data:[\"&cov_val&\"]}]}}\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1250,"y":360,"wires":[[]]}]

```

---

<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:** [3 March 2021 14:29 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/2 "2021-03-03T14:29:53Z")

</div>

I suspect you do not understand a few concepts.

1. Join node is used to join 2 or more flows of messages  
see this: [https://www.youtube.com/results?search\_query=node-red+join+two+payloads](https://www.youtube.com/results?search_query=node-red+join+two+payloads)

2. In your case, the only reason to join is because you split (branched off) the flow  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f76c4777f43119026931c815b545949c49fa025d.png)

the better solution is just do this all in series e.g...

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

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![ulrischa](https://avatars.discourse-cdn.com/v4/letter/u/e0b2c6/32.png) [@ulrischa](https://discourse.nodered.org/u/ulrischa)\
**Post date:** [3 March 2021 14:34 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/3 "2021-03-03T14:34:03Z")

</div>

But the html extraction leads to a sequence. I have to combine the sequence at some point in the flow

---

<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:** [3 March 2021 14:36 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/4 "2021-03-03T14:36:25Z")

</div>

what sequence?

The flow you posted is 100% possible to do without splitting and joining.

You need to watch the videos - especially the first link - you will see how you wrongly placed the join node.

---

<div class="post-metadata">

**Author:** ![ulrischa](https://avatars.discourse-cdn.com/v4/letter/u/e0b2c6/32.png) [@ulrischa](https://discourse.nodered.org/u/ulrischa)\
**Post date:** [3 March 2021 15:03 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/5 "2021-03-03T15:03:09Z")

</div>

watched the video and putted all one after the other. But the problem remains: I get single values and need to concatenate them to one string. But for two cases. I did it again, but same problem

```auto
[{"id":"6642db4d.a294f4","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"58c50cd5.3a2584","type":"html","z":"6642db4d.a294f4","name":"Lra ffb covid zahlen","property":"payload","outproperty":"payload","tag":".contenttable li","ret":"text","as":"multi","x":190,"y":320,"wires":[["38468fac.0db4e"]]},{"id":"5b418e99.f9c01","type":"http request","z":"6642db4d.a294f4","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.lra-ffb.de/aktuelles/corona-informationen/corona-statistik-infizierte-genesene-verstorbene-und-geimpfte-im-landkreis","tls":"","persist":false,"proxy":"","authType":"","x":150,"y":240,"wires":[["58c50cd5.3a2584"]]},{"id":"c2d4e182.ddef5","type":"inject","z":"6642db4d.a294f4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":160,"wires":[["5b418e99.f9c01"]]},{"id":"2f30e56e.1c5c2a","type":"change","z":"6642db4d.a294f4","name":"cov val","rules":[{"t":"set","p":"cov_val","pt":"msg","to":"$replace($split(payload,\": \")[1], \",\",\".\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":500,"wires":[["df2496db.96ff38"]]},{"id":"38468fac.0db4e","type":"change","z":"6642db4d.a294f4","name":"cov date","rules":[{"t":"set","p":"cov_date","pt":"msg","to":"\"'\"&$split(payload,\": \")[0]&\"'\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":400,"wires":[["2f30e56e.1c5c2a"]]},{"id":"df2496db.96ff38","type":"join","z":"6642db4d.a294f4","name":"","mode":"custom","build":"string","property":"cov_date","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":170,"y":600,"wires":[["4755be7e.d119e"]]},{"id":"4755be7e.d119e","type":"join","z":"6642db4d.a294f4","name":"","mode":"custom","build":"string","property":"cov_val","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":170,"y":660,"wires":[["308754b1.56877c"]]},{"id":"308754b1.56877c","type":"debug","z":"6642db4d.a294f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"cov_val","targetType":"msg","statusVal":"","statusType":"auto","x":330,"y":720,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![ulrischa](https://avatars.discourse-cdn.com/v4/letter/u/e0b2c6/32.png) [@ulrischa](https://discourse.nodered.org/u/ulrischa)\
**Post date:** [3 March 2021 15:30 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/6 "2021-03-03T15:30:22Z")

</div>

I get this with a simple python script in minutes. In nodered I spend one day.

---

<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:** [3 March 2021 16:19 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/7 "2021-03-03T16:19:36Z")

</div>

> [@ulrischa](#):
>
> I get this with a simple python script in minutes. In nodered I spend one day

it comes with experience.

First things first...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/6/8651ffcd58d9500a18547298e16e1197843045cb.png)  
↑ you need to re-watch this: [https://www.youtube.com/results?search\_query=node-red+join+two+payloads](https://www.youtube.com/results?search_query=node-red+join+two+payloads)

On to your issues...

So it looks like you are going about this the very hard way - trying to parse a JSON payload with JSONata.

Lets look at this from another way.

I assume you want the time and value split from the table in that page. something like this...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78e0dbb259436496b5dd35d82b5b9108561caf08.png)

So instead of spitting out a single text item per `li` we chose to set the HTML node to sent a single array with all values in the loop it and extract the data from the JS array...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1d188211fad63dcc8dfa971742ea94fe29c90cf.png)

```auto
[{"id":"44d40b20.3fd414","type":"html","z":"2680e2cc.e6dace","name":"Lra ffb covid zahlen","property":"payload","outproperty":"payload","tag":".contenttable li","ret":"text","as":"single","x":930,"y":200,"wires":[["afa2412a.6551b"]]},{"id":"58e5da76.091f54","type":"http request","z":"2680e2cc.e6dace","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.lra-ffb.de/aktuelles/corona-informationen/corona-statistik-infizierte-genesene-verstorbene-und-geimpfte-im-landkreis","tls":"","persist":false,"proxy":"","authType":"","x":1070,"y":140,"wires":[["44d40b20.3fd414"]]},{"id":"c85ceba9.120ca8","type":"inject","z":"2680e2cc.e6dace","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":900,"y":140,"wires":[["58e5da76.091f54"]]},{"id":"98cdd4f5.a9c408","type":"debug","z":"2680e2cc.e6dace","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":260,"wires":[]},{"id":"afa2412a.6551b","type":"function","z":"2680e2cc.e6dace","name":"process array of li","func":"var results = [];\nfor(let i = 0; i < msg.payload.length; i++) {\n let item = msg.payload[i];\n var parts = item.split(\":\");\n if(parts.length != 2 ) continue;\n results.push({\n date: parts[0].trim(),\n val: parts[1].trim(),\n })\n}\nmsg.payload = results;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1150,"y":200,"wires":[["98cdd4f5.a9c408"]]}]

```

* * *

### PS, that took me about 4 & 1/2 minutes. 😃 😃 😃

### PS2, it is untested (but should be close)

---

<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:** [2 May 2021 16:20 UTC](https://discourse.nodered.org/t/need-help-combining-flows/41957/8 "2021-05-02T16:20:13Z")

</div>

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