# Combine from switch nodes

**URL:** https://discourse.nodered.org/t/combine-from-switch-nodes/95478
**Category:** General
**Created:** [18 February 2025 07:26 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478 "2025-02-18T07:26:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![fourskin99](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@fourskin99](https://discourse.nodered.org/u/fourskin99)
#### Post date: [18 February 2025 07:26 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/1 "2025-02-18T07:26:40Z")

</div>

I want to select a number 10000 which in the middle of 00811000013600012. I already use split which I have split a single number and know I have a problem to combine the number to get my payload 10000. Please help me.

[flows.json](https://discourse.nodered.org/uploads/short-url/Ac8X642j7yznHXyCAs2XJenkdde.json) (6.2 KB)

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [18 February 2025 07:47 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/2 "2025-02-18T07:47:07Z")

</div>

If you always want the 5th to 10th characters you could use a function node and substring().  
Output as a string:

```auto
msg.payload = msg.payload.substring(4,9)
return msg;

```

Or as a number:

```auto
msg.payload = Number(msg.payload.substring(4,9))
return msg;

```

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [18 February 2025 07:49 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/3 "2025-02-18T07:49:22Z")

</div>

To do it with a split node use between in the switch node and check ` recreate message sequences`  
Then use a join node set to automatic

e.g.

```auto
[{"id":"b154902499dfbd00","type":"inject","z":"d1395164b4eec73e","name":"00811000013600012","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"00811000013600012","payloadType":"str","x":220,"y":5760,"wires":[["3bf08148d642637a"]]},{"id":"3bf08148d642637a","type":"split","z":"d1395164b4eec73e","name":"","splt":"1","spltType":"len","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","property":"payload","x":430,"y":5760,"wires":[["506ab0bddcbd9146"]]},{"id":"506ab0bddcbd9146","type":"switch","z":"d1395164b4eec73e","name":"","property":"parts.index","propertyType":"msg","rules":[{"t":"btwn","v":"4","vt":"num","v2":"8","v2t":"num"}],"checkall":"true","repair":true,"outputs":1,"x":570,"y":5760,"wires":[["6f5596f6b2d2cda5"]]},{"id":"6f5596f6b2d2cda5","type":"join","z":"d1395164b4eec73e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":"false","timeout":"","count":"","reduceRight":false,"x":690,"y":5760,"wires":[["5557b67f0d0a1277"]]},{"id":"5557b67f0d0a1277","type":"debug","z":"d1395164b4eec73e","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":5760,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![fourskin99](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@fourskin99](https://discourse.nodered.org/u/fourskin99)
#### Post date: [18 February 2025 07:51 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/4 "2025-02-18T07:51:12Z")

</div>

okay thankyou so much

---

<div class="post-metadata">

### Author: ![fourskin99](https://avatars.discourse-cdn.com/v4/letter/f/b3f665/32.png) [@fourskin99](https://discourse.nodered.org/u/fourskin99)
#### Post date: [18 February 2025 07:51 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/5 "2025-02-18T07:51:41Z")

</div>

okay thankyou

---

<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: [19 May 2025 07:52 UTC](https://discourse.nodered.org/t/combine-from-switch-nodes/95478/6 "2025-05-19T07:52:17Z")

</div>

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