# Split array in 2 or 3 arrays

**URL:** <https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292>\
**Category:** General\
**Created:** [18 March 2020 21:43 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292 "2020-03-18T21:43:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [18 March 2020 21:43 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/1 "2020-03-18T21:43:48Z")

</div>

Hi, i have been working on a dashboard with a table to copy paste values i will put a picture of the result payload when i do the paste of values is an array with 8 or more objects, and inside this objects there is 3 strings with the values that i paste so basically i want to split it and grouping the values like in 3 strings for example string 1 will be: col1 = ["1","2","3","4","5","6","7"]; and the same with the values of column2 and 3.  
i will put the code that i have afer the function of the table i put the action what i'm trying to to with this values like a delayed msg with the respective values on the table.

![copypaste](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/3997e4265a2e85c5908134c0d73d9252fd98b334.png)

```auto
[{"id":"44274c4b.5c88a4","type":"change","z":"562890f7.12e7c","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Delay\"},{\"field\":\"col2\",\"title\":\"delayed msg1\"},{\"field\":\"col3\",\"title\":\"delayed msg2\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":360,"wires":[["4a09af46.57b2b"]]},{"id":"acfe497e.363b58","type":"debug","z":"562890f7.12e7c","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1009,"y":343,"wires":[]},{"id":"4a09af46.57b2b","type":"ui_table","z":"562890f7.12e7c","group":"465d8685.705e18","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":632,"y":360,"wires":[["934e8b28.585508"]]},{"id":"ea363619.991058","type":"function","z":"562890f7.12e7c","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":410,"y":309,"wires":[[]]},{"id":"ea8d6c95.7abe6","type":"ui_ui_control","z":"562890f7.12e7c","name":"on tab change","events":"change","x":180,"y":360,"wires":[["44274c4b.5c88a4"]]},{"id":"934e8b28.585508","type":"switch","z":"562890f7.12e7c","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":806,"y":360,"wires":[["acfe497e.363b58"],[]]},{"id":"ab5cfe0e.3301f","type":"ui_template","z":"562890f7.12e7c","group":"a6f95c80.0b168","name":"Clock Toolbar","order":2,"width":"0","height":"0","format":"<script id=\"titleScript\" type=\"text/javascript\">\n\n$(function() {\n if($('.md-toolbar-tools').length != 0){\n loadClock();\n }else setTimeout(loadClock, 500)\n});\n\nfunction loadClock(){\n $('#clock').remove();\n var toolbar = $('.md-toolbar-tools');\n \n var div = $('<div/>');\n var p = $('<p/ id=\"clock\">');\n \n div.append(p);\n div[0].style.margin = '5px 5px 5px auto';\n toolbar.append(div);\n\n function displayTitle(lh) {\n p.text(lh); \n }\n \n function upTime() {\n var d = new Date();\n p.text(d.toLocaleString());\n }\n\n if(document.clockInterval){ \n clearInterval(document.clockInterval);\n document.clockInterval = null;\n }\n \n document.clockInterval = setInterval(upTime,1000);\n}\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"global","x":180,"y":240,"wires":[[]]},{"id":"1b21414e.266e6f","type":"dsm","z":"562890f7.12e7c","name":"timer","sm_config":"{\n \"data\": {\n \"delay1\": 1000,\n \"delay2\": 2000\n },\n \"methods\": {\n \"delay1\": {\n \"name\": \"setData\"\n },\n \"delay2\": {\n \"name\": \"setData\"\n },\n \"timer1\": {\n \"name\": \"timer\",\n \"param\": \"delay1\"\n },\n \"timer2\": {\n \"name\": \"timer\",\n \"param\": \"delay2\"\n },\n \"status\": {\n \"fill\": \"blue\",\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"msg.topic\"\n }\n }\n }\n}\n","x":580,"y":480,"wires":[["c1201b84.2bdb08","db26b3b2.04b65"]]},{"id":"2ab63a45.666476","type":"inject","z":"562890f7.12e7c","name":"","topic":"delay1","payload":"10000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":460,"wires":[["1b21414e.266e6f"]]},{"id":"2a605c38.c41f94","type":"inject","z":"562890f7.12e7c","name":"","topic":"delay2","payload":"30000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":331,"y":498,"wires":[["1b21414e.266e6f"]]},{"id":"c1201b84.2bdb08","type":"debug","z":"562890f7.12e7c","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":730,"y":480,"wires":[]},{"id":"fc283a2e.d3e7d8","type":"inject","z":"562890f7.12e7c","name":"","topic":"timer1","payload":"delayed msg 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":540,"wires":[["1b21414e.266e6f"]]},{"id":"1c01c842.f7ecd8","type":"inject","z":"562890f7.12e7c","name":"","topic":"timer2","payload":"delayed msg 2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":580,"wires":[["1b21414e.266e6f"]]},{"id":"db26b3b2.04b65","type":"debug","z":"562890f7.12e7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":740,"y":580,"wires":[]},{"id":"465d8685.705e18","type":"ui_group","name":"Group 2","tab":"44f356f.ed141a8","order":2,"disp":true,"width":16},{"id":"a6f95c80.0b168","type":"ui_group","z":"","name":"hidden_group","tab":"33a639e4.55f2c6","disp":false,"width":"6","collapse":false},{"id":"44f356f.ed141a8","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false},{"id":"33a639e4.55f2c6","type":"ui_tab","z":"","name":"Zooland Sys","icon":"home","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [18 March 2020 23:58 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/2 "2020-03-18T23:58:23Z")

</div>

Ok, now I know what you mean. I would do it in a function node.

- loop trough the rows
- loop through the keys in one row (Object.keys(row))
- push each value in a separate array  
That‘s only the layout

---

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [19 March 2020 00:49 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/3 "2020-03-19T00:49:31Z")

</div>

hi, i'm trying with this but i don't know what is wrong.

```auto
[{"id":"6df85d21.d47644","type":"change","z":"67846756.6cbc48","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Time\"},{\"field\":\"col2\",\"title\":\"Setpoint\"},{\"field\":\"col3\",\"title\":\"Column #3\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"there is a issue with small or empty tables\",\"col2\":\"will be dixed soon\",\"col3\":\"\"},{\"col1\":\"Untill then we have\",\"col2\":\"to fill in some\",\"col3\":\"dummy lines\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":400,"wires":[["d87259eb.100a18"]]},{"id":"40fe2c63.3573a4","type":"debug","z":"67846756.6cbc48","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1209,"y":383,"wires":[]},{"id":"d87259eb.100a18","type":"ui_table","z":"67846756.6cbc48","group":"465d8685.705e18","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":832,"y":400,"wires":[["9a640db1.6b1bd"]]},{"id":"81974a32.b55048","type":"function","z":"67846756.6cbc48","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":610,"y":349,"wires":[[]]},{"id":"c371d935.665a98","type":"ui_ui_control","z":"67846756.6cbc48","name":"on tab change","events":"change","x":380,"y":400,"wires":[["6df85d21.d47644"]]},{"id":"9a640db1.6b1bd","type":"switch","z":"67846756.6cbc48","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1006,"y":400,"wires":[["40fe2c63.3573a4","514f7107.98993"],[]]},{"id":"f6995aad.cadbc8","type":"ui_template","z":"67846756.6cbc48","group":"a6f95c80.0b168","name":"Clock Toolbar","order":2,"width":"0","height":"0","format":"<script id=\"titleScript\" type=\"text/javascript\">\n\n$(function() {\n if($('.md-toolbar-tools').length != 0){\n loadClock();\n }else setTimeout(loadClock, 500)\n});\n\nfunction loadClock(){\n $('#clock').remove();\n var toolbar = $('.md-toolbar-tools');\n \n var div = $('<div/>');\n var p = $('<p/ id=\"clock\">');\n \n div.append(p);\n div[0].style.margin = '5px 5px 5px auto';\n toolbar.append(div);\n\n function displayTitle(lh) {\n p.text(lh); \n }\n \n function upTime() {\n var d = new Date();\n p.text(d.toLocaleString());\n }\n\n if(document.clockInterval){ \n clearInterval(document.clockInterval);\n document.clockInterval = null;\n }\n \n document.clockInterval = setInterval(upTime,1000);\n}\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"global","x":380,"y":280,"wires":[[]]},{"id":"514f7107.98993","type":"function","z":"67846756.6cbc48","name":"","func":"var key = Object.keys( msg.payload.col1);\nmsg.payload = key;\nreturn msg;\n","outputs":1,"noerr":0,"x":1170,"y":300,"wires":[["237f0ccb.c08954"]]},{"id":"237f0ccb.c08954","type":"debug","z":"67846756.6cbc48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1380,"y":320,"wires":[]},{"id":"465d8685.705e18","type":"ui_group","name":"Group 2","tab":"44f356f.ed141a8","order":2,"disp":true,"width":16},{"id":"a6f95c80.0b168","type":"ui_group","z":"","name":"hidden_group","tab":"33a639e4.55f2c6","disp":false,"width":"6","collapse":false},{"id":"44f356f.ed141a8","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false},{"id":"33a639e4.55f2c6","type":"ui_tab","z":"","name":"Zooland Sys","icon":"home","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [19 March 2020 01:31 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/4 "2020-03-19T01:31:53Z")

</div>

now i tried with this one but the output appears like undefined.

```auto
[{"id":"6df85d21.d47644","type":"change","z":"67846756.6cbc48","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Time\"},{\"field\":\"col2\",\"title\":\"Setpoint\"},{\"field\":\"col3\",\"title\":\"Column #3\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"there is a issue with small or empty tables\",\"col2\":\"will be dixed soon\",\"col3\":\"\"},{\"col1\":\"Untill then we have\",\"col2\":\"to fill in some\",\"col3\":\"dummy lines\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":400,"wires":[["d87259eb.100a18"]]},{"id":"40fe2c63.3573a4","type":"debug","z":"67846756.6cbc48","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1209,"y":383,"wires":[]},{"id":"d87259eb.100a18","type":"ui_table","z":"67846756.6cbc48","group":"465d8685.705e18","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":832,"y":400,"wires":[["9a640db1.6b1bd"]]},{"id":"81974a32.b55048","type":"function","z":"67846756.6cbc48","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":610,"y":349,"wires":[[]]},{"id":"c371d935.665a98","type":"ui_ui_control","z":"67846756.6cbc48","name":"on tab change","events":"change","x":380,"y":400,"wires":[["6df85d21.d47644"]]},{"id":"9a640db1.6b1bd","type":"switch","z":"67846756.6cbc48","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1006,"y":400,"wires":[["40fe2c63.3573a4","514f7107.98993"],[]]},{"id":"f6995aad.cadbc8","type":"ui_template","z":"67846756.6cbc48","group":"a6f95c80.0b168","name":"Clock Toolbar","order":2,"width":"0","height":"0","format":"<script id=\"titleScript\" type=\"text/javascript\">\n\n$(function() {\n if($('.md-toolbar-tools').length != 0){\n loadClock();\n }else setTimeout(loadClock, 500)\n});\n\nfunction loadClock(){\n $('#clock').remove();\n var toolbar = $('.md-toolbar-tools');\n \n var div = $('<div/>');\n var p = $('<p/ id=\"clock\">');\n \n div.append(p);\n div[0].style.margin = '5px 5px 5px auto';\n toolbar.append(div);\n\n function displayTitle(lh) {\n p.text(lh); \n }\n \n function upTime() {\n var d = new Date();\n p.text(d.toLocaleString());\n }\n\n if(document.clockInterval){ \n clearInterval(document.clockInterval);\n document.clockInterval = null;\n }\n \n document.clockInterval = setInterval(upTime,1000);\n}\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"global","x":380,"y":280,"wires":[[]]},{"id":"514f7107.98993","type":"function","z":"67846756.6cbc48","name":"","func":"var keyt = msg.col1;\nmsg.payload = keyt;\nreturn msg;\n\n","outputs":1,"noerr":0,"x":1170,"y":300,"wires":[["237f0ccb.c08954"]]},{"id":"237f0ccb.c08954","type":"debug","z":"67846756.6cbc48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1380,"y":320,"wires":[]},{"id":"465d8685.705e18","type":"ui_group","name":"Group 2","tab":"44f356f.ed141a8","order":2,"disp":true,"width":16},{"id":"a6f95c80.0b168","type":"ui_group","z":"","name":"hidden_group","tab":"33a639e4.55f2c6","disp":false,"width":"6","collapse":false},{"id":"44f356f.ed141a8","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false},{"id":"33a639e4.55f2c6","type":"ui_tab","z":"","name":"Zooland Sys","icon":"home","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [19 March 2020 06:50 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/5 "2020-03-19T06:50:44Z")

</div>

When you share „only“ JavaScript code it is better to share the code and not the flow. Than people who have no access to Node-RED or enough time can take a direct look without the need of importing your flow.

Don’t forget to use the code function.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 March 2020 10:24 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/6 "2020-03-19T10:24:56Z")

</div>

Where in your latest flow are you trying to do work?  
show an example of what you want the final result to look like.

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [19 March 2020 17:10 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/7 "2020-03-19T17:10:00Z")

</div>

So perhaps try something like this

```auto
var msgOut = {payload:{}};
msg.payload.forEach((row) => { // loop through all rows
    Object.keys(row).forEach((key) => { // loop trough all collumns in a row
        if (!msgOut.payload.hasOwnProperty(key)) msgOut.payload[key]=[]; // create new column array if not extisting
        msgOut.payload[key].push(row[key]); // push value on column array
    })
})
return msgOut;

```

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

pasted table:

| col1 | col2 | col3 |
| --- | --- | --- |
| 1 | A | Text 1 |
| 2 | B | Text 2 |
| 3 | C | Text 3 |
| 4 | D | Text 4 |
| 5 | E | Text 5 |

```auto
[{"id":"f7adbeb6.d76f1","type":"change","z":"ab797823.3396a8","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Time\"},{\"field\":\"col2\",\"title\":\"Setpoint\"},{\"field\":\"col3\",\"title\":\"Column #3\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"there is a issue with small or empty tables\",\"col2\":\"will be dixed soon\",\"col3\":\"\"},{\"col1\":\"Untill then we have\",\"col2\":\"to fill in some\",\"col3\":\"dummy lines\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":416,"y":578,"wires":[["3867401c.fa1c7"]]},{"id":"c1d3a47a.f44448","type":"debug","z":"ab797823.3396a8","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1035,"y":561,"wires":[]},{"id":"3867401c.fa1c7","type":"ui_table","z":"ab797823.3396a8","group":"a67c03c2.f7729","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":658,"y":578,"wires":[["cd153ef7.9523d"]]},{"id":"e8089623.901488","type":"function","z":"ab797823.3396a8","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":436,"y":527,"wires":[[]]},{"id":"5eacef1e.27f56","type":"ui_ui_control","z":"ab797823.3396a8","name":"on tab change","events":"change","x":206,"y":578,"wires":[["f7adbeb6.d76f1"]]},{"id":"cd153ef7.9523d","type":"switch","z":"ab797823.3396a8","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":832,"y":578,"wires":[["c1d3a47a.f44448","453d4f15.9b8d7"],[]]},{"id":"453d4f15.9b8d7","type":"function","z":"ab797823.3396a8","name":"rows 2 columns","func":"var msgOut = {payload:{}};\nmsg.payload.forEach((row) => { // loop through all rows\n Object.keys(row).forEach((key) => { // loop trough all collumns in a row\n if (!msgOut.payload.hasOwnProperty(key)) msgOut.payload[key]=[]; // create new column array if not extisting\n msgOut.payload[key].push(row[key]); // push value on column array\n })\n})\nreturn msgOut;\n\n","outputs":1,"noerr":0,"x":1015,"y":493,"wires":[["c05c5d0e.b228d"]]},{"id":"c05c5d0e.b228d","type":"debug","z":"ab797823.3396a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1209,"y":493,"wires":[]},{"id":"a67c03c2.f7729","type":"ui_group","name":"Group 2","tab":"6c190871.57d428","order":2,"disp":true,"width":16},{"id":"6c190871.57d428","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [20 March 2020 01:17 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/8 "2020-03-20T01:17:02Z")

</div>

thank you so much that's exactly what i need it, my final flow is this one.

can you reconmend me some page or course to learn to do that?

```auto
[{"id":"7a34b7cd.fd3a68","type":"change","z":"9651fe9e.18efd","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Time\"},{\"field\":\"col2\",\"title\":\"Setpoint\"},{\"field\":\"col3\",\"title\":\"Column #3\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"there is a issue with small or empty tables\",\"col2\":\"will be dixed soon\",\"col3\":\"\"},{\"col1\":\"Untill then we have\",\"col2\":\"to fill in some\",\"col3\":\"dummy lines\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":340,"wires":[["973f156b.3c68c8"]]},{"id":"5862606d.43bc3","type":"debug","z":"9651fe9e.18efd","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":909,"y":323,"wires":[]},{"id":"973f156b.3c68c8","type":"ui_table","z":"9651fe9e.18efd","group":"8897a1f9.d11ff","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":532,"y":340,"wires":[["a5c96042.6f3e8"]]},{"id":"20054fdf.90b55","type":"function","z":"9651fe9e.18efd","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":310,"y":289,"wires":[[]]},{"id":"a4c6ee28.55171","type":"ui_ui_control","z":"9651fe9e.18efd","name":"on tab change","events":"change","x":80,"y":340,"wires":[["7a34b7cd.fd3a68"]]},{"id":"a5c96042.6f3e8","type":"switch","z":"9651fe9e.18efd","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":706,"y":340,"wires":[["5862606d.43bc3","713d3ce0.f42714"],[]]},{"id":"713d3ce0.f42714","type":"function","z":"9651fe9e.18efd","name":"rows 2 columns","func":"var msgOut = {payload:{}};\nmsg.payload.forEach((row) => { // loop through all rows\n Object.keys(row).forEach((key) => { // loop trough all collumns in a row\n if (!msgOut.payload.hasOwnProperty(key)) msgOut.payload[key]=[]; // create new column array if not extisting\n msgOut.payload[key].push(row[key]); // push value on column array\n })\n})\nreturn msgOut;\n\n","outputs":1,"noerr":0,"x":889,"y":255,"wires":[["1039d18a.8b94be","e3ee6be.c487798","e97147d8.e19df8","115c61be.13bf9e"]]},{"id":"1039d18a.8b94be","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1083,"y":255,"wires":[]},{"id":"115c61be.13bf9e","type":"function","z":"9651fe9e.18efd","name":"","func":"var col3 = msg.payload.col3;\nmsg.payload = col3;\nreturn msg;","outputs":1,"noerr":0,"x":1090,"y":140,"wires":[["d895419e.45b4e"]]},{"id":"e97147d8.e19df8","type":"function","z":"9651fe9e.18efd","name":"","func":"var col2 = msg.payload.col2;\nmsg.payload = col2;\nreturn msg;","outputs":1,"noerr":0,"x":1090,"y":100,"wires":[["bb98ed3d.deb57"]]},{"id":"e3ee6be.c487798","type":"function","z":"9651fe9e.18efd","name":"","func":"var col1 = msg.payload.col1;\nmsg.payload = col1;\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":60,"wires":[["89575adc.a7b8d8"]]},{"id":"89575adc.a7b8d8","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1230,"y":60,"wires":[]},{"id":"bb98ed3d.deb57","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1250,"y":100,"wires":[]},{"id":"d895419e.45b4e","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1270,"y":140,"wires":[]},{"id":"8897a1f9.d11ff","type":"ui_group","name":"Group 2","tab":"1418efe4.abb68","order":2,"disp":true,"width":16},{"id":"1418efe4.abb68","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [24 March 2020 05:28 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/9 "2020-03-24T05:28:51Z")

</div>

hey guys i have some issues with a function that i want to do. i will put my flow and thing is that i'm trying to make a timer and it will have a msg to send on payload and the delay what i will choose.

```auto
[{"id":"7a34b7cd.fd3a68","type":"change","z":"9651fe9e.18efd","name":"ui_control & placeholder","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":20,\"tabulator\":{\"layout\":\"fitColumns\",\"clipboard\":true,\"clipboardCopySelector\":\"table\",\"clipboardCopyStyled\":false,\"clipboardPasteAction\":\"function(rowData){ this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData}); return this.table.replaceData(rowData); }\",\"columns\":[{\"field\":\"col1\",\"title\":\"Time\"},{\"field\":\"col2\",\"title\":\"Setpoint\"},{\"field\":\"col3\",\"title\":\"Column #3\"}]}}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"[{\"col1\":\"click here & CTRL+v\",\"col2\":\"or click here & CTRL+v\",\"col3\":\"or click here & CTRL+v\"},{\"col1\":\" or on any other cell\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"\",\"col2\":\"\",\"col3\":\"\"},{\"col1\":\"there is a issue with small or empty tables\",\"col2\":\"will be dixed soon\",\"col3\":\"\"},{\"col1\":\"Untill then we have\",\"col2\":\"to fill in some\",\"col3\":\"dummy lines\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":340,"wires":[["973f156b.3c68c8"]]},{"id":"5862606d.43bc3","type":"debug","z":"9651fe9e.18efd","name":"clipboardPasteAction","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":900,"y":380,"wires":[]},{"id":"973f156b.3c68c8","type":"ui_table","z":"9651fe9e.18efd","group":"8897a1f9.d11ff","name":"Copy & Paste","order":1,"width":16,"height":7,"columns":[],"outputs":1,"cts":true,"x":532,"y":340,"wires":[["a5c96042.6f3e8"]]},{"id":"20054fdf.90b55","type":"function","z":"9651fe9e.18efd","name":"clipboardPasteAction Callback","func":"// callback: clipboardPasteAction\n// DO NOT USE IN A FLOW!\n\nclipboardPasteAction = \n// copy from here\nfunction(rowData){\n this.send({ui_control:{callback:'clipboardPasteAction'},payload:rowData});\n return this.table.replaceData(rowData);\n}\n// until here\n// use the Visual Editor!\n// paste into ui_table JSON \"clipboardPasteAction\":\"function(....\"\n\n// technical details\n//\n// the example function ends with\n//\n// return this.table.updateData(rows);\n// \n// but that's not updating the data (because it does try to update data through\n// the index field (default \"id\")\n// replaceData simply erase all existing rowData and fills in the pasted data\n// that's what we want","outputs":1,"noerr":0,"x":310,"y":289,"wires":[[]]},{"id":"a4c6ee28.55171","type":"ui_ui_control","z":"9651fe9e.18efd","name":"on tab change","events":"change","x":80,"y":340,"wires":[["7a34b7cd.fd3a68"]]},{"id":"a5c96042.6f3e8","type":"switch","z":"9651fe9e.18efd","name":"","property":"ui_control.callback","propertyType":"msg","rules":[{"t":"eq","v":"clipboardPasteAction","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":706,"y":340,"wires":[["5862606d.43bc3","713d3ce0.f42714"],[]]},{"id":"713d3ce0.f42714","type":"function","z":"9651fe9e.18efd","name":"rows 2 columns","func":"var msgOut = {payload:{}};\nmsg.payload.forEach((row) => { // loop through all rows\n Object.keys(row).forEach((key) => { // loop trough all collumns in a row\n if (!msgOut.payload.hasOwnProperty(key)) msgOut.payload[key]=[]; // create new column array if not extisting\n msgOut.payload[key].push(row[key]); // push value on column array\n })\n})\nreturn msgOut;\n\n","outputs":1,"noerr":0,"x":889,"y":255,"wires":[["1039d18a.8b94be","e97147d8.e19df8","115c61be.13bf9e","e3ee6be.c487798"]]},{"id":"1039d18a.8b94be","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":300,"wires":[]},{"id":"115c61be.13bf9e","type":"function","z":"9651fe9e.18efd","name":"","func":"var col3 = msg.payload.col3;\nmsg.payload = col3;\nreturn msg;","outputs":1,"noerr":0,"x":1090,"y":260,"wires":[["d895419e.45b4e"]]},{"id":"e97147d8.e19df8","type":"function","z":"9651fe9e.18efd","name":"","func":"var col2 = msg.payload.col2;\nmsg.payload = col2;\nreturn msg;","outputs":1,"noerr":0,"x":1090,"y":200,"wires":[["bb98ed3d.deb57"]]},{"id":"e3ee6be.c487798","type":"function","z":"9651fe9e.18efd","name":"","func":"var col1 = (msg.payload.col1);\n//var setpoint1 = Number(global.get(\"presion1\"));\nmsg.payload = col1;\nreturn msg;","outputs":1,"noerr":0,"x":1090,"y":140,"wires":[["23957d7b.740a32"]]},{"id":"bb98ed3d.deb57","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1250,"y":200,"wires":[]},{"id":"d895419e.45b4e","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1250,"y":260,"wires":[]},{"id":"23957d7b.740a32","type":"split","z":"9651fe9e.18efd","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":1230,"y":120,"wires":[["4b8bf995.895d08"]]},{"id":"3b0530e8.1f152","type":"dsm","z":"9651fe9e.18efd","name":"timer","sm_config":"{\n \"data\": {\n \"delay1\": 1000,\n \"delay2\": 2000\n },\n \"methods\": {\n \"delay1\": {\n \"name\": \"setData\"\n },\n \"delay2\": {\n \"name\": \"setData\"\n },\n \"timer1\": {\n \"name\": \"timer\",\n \"param\": \"delay1\"\n },\n \"timer2\": {\n \"name\": \"timer\",\n \"param\": \"delay2\"\n },\n \"status\": {\n \"fill\": \"blue\",\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"msg.topic\"\n }\n }\n }\n}\n","x":1760,"y":40,"wires":[["dbf6fa43.680a58","959352eb.2c3cb"]]},{"id":"dbf6fa43.680a58","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1950,"y":20,"wires":[]},{"id":"959352eb.2c3cb","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1970,"y":80,"wires":[]},{"id":"d4395555.5a7b48","type":"inject","z":"9651fe9e.18efd","name":"","topic":"delay1","payload":"10000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1430,"y":40,"wires":[["3b0530e8.1f152"]]},{"id":"7bd69d09.2d3714","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1610,"y":140,"wires":[]},{"id":"4b8bf995.895d08","type":"change","z":"9651fe9e.18efd","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":120,"wires":[["7bd69d09.2d3714","b9286e17.f4983"]]},{"id":"b9286e17.f4983","type":"function","z":"9651fe9e.18efd","name":"","func":"var timer1 = msg.payload; //get payload\nmsg.topic = timer1;\nreturn msg;","outputs":1,"noerr":0,"x":1590,"y":80,"wires":[["3b0530e8.1f152"]]},{"id":"8897a1f9.d11ff","type":"ui_group","name":"Group 2","tab":"1418efe4.abb68","order":2,"disp":true,"width":16},{"id":"1418efe4.abb68","type":"ui_tab","z":"","name":"copypaste","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![lalo](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@lalo](https://discourse.nodered.org/u/lalo)\
**Post date:** [24 March 2020 05:55 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/10 "2020-03-24T05:55:37Z")

</div>

the function is this one but i don't found the issue.

```auto
[{"id":"947f26cb.678908","type":"inject","z":"9651fe9e.18efd","name":"","topic":"delay2","payload":"30000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":331,"y":518,"wires":[["94edd52.6c0ce28"]]},{"id":"f84f8738.798a68","type":"inject","z":"9651fe9e.18efd","name":"","topic":"delay1","payload":"10000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":480,"wires":[["94edd52.6c0ce28"]]},{"id":"94edd52.6c0ce28","type":"dsm","z":"9651fe9e.18efd","name":"timer","sm_config":"{\n \"data\": {\n \"delay1\": 1000,\n \"delay2\": 2000\n },\n \"methods\": {\n \"delay1\": {\n \"name\": \"setData\"\n },\n \"delay2\": {\n \"name\": \"setData\"\n },\n \"timer1\": {\n \"name\": \"timer\",\n \"param\": \"delay1\"\n },\n \"timer2\": {\n \"name\": \"timer\",\n \"param\": \"delay2\"\n },\n \"status\": {\n \"fill\": \"blue\",\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"msg.topic\"\n }\n }\n }\n}\n","x":580,"y":500,"wires":[["6cee6802.511128","a3b547d6.78de18"]]},{"id":"6cee6802.511128","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":730,"y":500,"wires":[]},{"id":"c1106273.41917","type":"inject","z":"9651fe9e.18efd","name":"","topic":"timer1","payload":"delayed msg 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":560,"wires":[["94edd52.6c0ce28"]]},{"id":"fc4510a3.7a532","type":"inject","z":"9651fe9e.18efd","name":"","topic":"timer2","payload":"delayed msg 2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":600,"wires":[["94edd52.6c0ce28"]]},{"id":"a3b547d6.78de18","type":"debug","z":"9651fe9e.18efd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":740,"y":600,"wires":[]}]

```

---

<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:** [7 April 2020 05:55 UTC](https://discourse.nodered.org/t/split-array-in-2-or-3-arrays/23292/11 "2020-04-07T05:55:40Z")

</div>

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