# Combine two arrays based on line number

**URL:** <https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071>\
**Category:** General\
**Created:** [3 August 2020 04:17 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071 "2020-08-03T04:17:40Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 04:17 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/1 "2020-08-03T04:17:41Z")

</div>

Hi All, I have two arrays that i've created from a string. What I would like to do is join them back together based on their line number or array ID. I see there is ZIP json expression but i'm lost on how to use it.

First Array

`[" (20 TOTAL)","1. com.cubcadet.app:id/robot_name_tv","2. com.cubcadet.app:id/dashboard_toggle_text","3. com.cubcadet.app:id/arc","4. com.cubcadet.app:id/dashboard_start_button_text","5. com.cubcadet.app:id/tv_menu_text","6. com.cubcadet.app:id/tv_menu_text","7. com.cubcadet.app:id/tv_menu_text","8. com.cubcadet.app:id/tv_menu_text","9. com.cubcadet.app:id/tv_menu_text","10. com.cubcadet.app:id/dashboard_toggle","11. com.cubcadet.app:id/custom_switch_toggle_text_off","12. com.cubcadet.app:id/dashboard_next_operation_text_top_title2","13. com.cubcadet.app:id/dashboard_next_operation_text_day2","14. com.cubcadet.app:id/dashboard_next_operation_text_top_date2","15. com.cubcadet.app:id/dashboard_next_operation_text_top_time2","16. com.cubcadet.app:id/dashboard_next_operation_text_top_title","17. com.cubcadet.app:id/dashboard_next_operation_text_day","18. com.cubcadet.app:id/dashboard_next_operation_text_top_date","19. com.cubcadet.app:id/dashboard_next_operation_text_top_time","20. com.cubcadet.app:id/dashboard_robot_location","",""]`

Second Array

`[" (20 TOTAL)","1. RC","2. SCHEDULE","3. Mow","4. Mow","5. Help Center","6. Menu","7. Schedule","8. History","9. Manual","10. Schedule off","11. OFF","12. Previous operation","13. ---","14. --- --","15. --:--","16. Next operation","17. ---","18. --- --","19. --:--","20. Out of range"]`

In the end my ideal outcome would be something like for each line.

msg.topic = payload[0][0] (line 0 from array 0)  
msg.payload = payload[1][0] (line 0 from array 1)

---

<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 August 2020 06:15 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/2 "2020-08-03T06:15:31Z")

</div>

Hi @JohnnyPicnic this is a relatively simple task but I suspect that there are better ways of preparing your data.

Few of questions...

1. Where is the original string coming from
2. Where is the final result going (dashboard? MQTT?)

If you post your flow someone will take a look.

Ps, enclose the exported flow in triple backticks (to prevent forum messing with it)...  
`````  
`paste flow between backticks like this`  
`````

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 16:42 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/3 "2020-08-03T16:42:13Z")

</div>

Here is the string being sent from Tasker on an Android phone with MQTT.

```auto
APP NAME
Cub Cadet XR 2.0

APP PACKAGE
com.cubcadet.app

TEXT ELEMENTS - (20 TOTAL)
1. RC
2. SCHEDULE
3. Mow
now
4. Mow
now
5. Help Center
6. Menu
7. Schedule
8. History
9. Manual
10. Schedule off
11. OFF
12. Previous operation
13. ---
14. --- --
15. --:--
16. Next operation
17. ---
18. --- --
19. --:--
20. Out of range

ELEMENT ID's - (20 TOTAL)
1. com.cubcadet.app:id/robot_name_tv
2. com.cubcadet.app:id/dashboard_toggle_text
3. com.cubcadet.app:id/arc
4. com.cubcadet.app:id/dashboard_start_button_text
5. com.cubcadet.app:id/tv_menu_text
6. com.cubcadet.app:id/tv_menu_text
7. com.cubcadet.app:id/tv_menu_text
8. com.cubcadet.app:id/tv_menu_text
9. com.cubcadet.app:id/tv_menu_text
10. com.cubcadet.app:id/dashboard_toggle
11. com.cubcadet.app:id/custom_switch_toggle_text_off
12. com.cubcadet.app:id/dashboard_next_operation_text_top_title2
13. com.cubcadet.app:id/dashboard_next_operation_text_day2
14. com.cubcadet.app:id/dashboard_next_operation_text_top_date2
15. com.cubcadet.app:id/dashboard_next_operation_text_top_time2
16. com.cubcadet.app:id/dashboard_next_operation_text_top_title
17. com.cubcadet.app:id/dashboard_next_operation_text_day
18. com.cubcadet.app:id/dashboard_next_operation_text_top_date
19. com.cubcadet.app:id/dashboard_next_operation_text_top_time
20. com.cubcadet.app:id/dashboard_robot_location

ELEMENT COORDINATES - (20 TOTAL)
1. 74,154
2. 413,286
3. 540,1128
4. 279,1127
5. 496,1707
6. 243,1772
7. 720,1014
8. 768,1271
9. 687,1519
10. 652,293
11. 692,289
12. 217,403
13. 130,504
14. 276,466
15. 270,523
16. 698,403
17. 648,504
18. 794,466
19. 788,523
20. 870,1880

```

And here is my flow.

```auto
[{"id":"9a3b75ea.8b0258","type":"mqtt in","z":"392484c1.36304c","name":"","topic":"robomow/uiquery","qos":"2","datatype":"auto","broker":"54e9a23d.c659fc","x":110,"y":1100,"wires":[["7acce3ca.b95eac","1dbcf997.a9b776","a3883bde.313c28","dda80edc.7c432"]]},{"id":"7acce3ca.b95eac","type":"string","z":"392484c1.36304c","name":"Text","methods":[{"name":"getRightMost","params":[{"type":"str","value":"TEXT ELEMENTS -"}]},{"name":"getLeftMost","params":[{"type":"str","value":"ELEMENT ID's -"}]},{"name":"strip","params":[{"type":"str","value":"now"}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":300,"y":1100,"wires":[["e9de118b.2fedd"]]},{"id":"1dbcf997.a9b776","type":"string","z":"392484c1.36304c","name":"ID's","methods":[{"name":"getRightMost","params":[{"type":"str","value":"ELEMENT ID's -"}]},{"name":"getLeftMost","params":[{"type":"str","value":"ELEMENT COORDINATES - "}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":300,"y":1140,"wires":[["e4b2a04b.33a8"]]},{"id":"a3883bde.313c28","type":"string","z":"392484c1.36304c","name":"COORDINATES","methods":[{"name":"getRightMost","params":[{"type":"str","value":"ELEMENT COORDINATES - "}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":330,"y":1180,"wires":[["38df51fe.d2a8ee"]]},{"id":"dda80edc.7c432","type":"debug","z":"392484c1.36304c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":310,"y":1030,"wires":[]},{"id":"e9de118b.2fedd","type":"split","z":"392484c1.36304c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"value","x":450,"y":1100,"wires":[["31be5018.92c8f"]]},{"id":"e4b2a04b.33a8","type":"split","z":"392484c1.36304c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":450,"y":1140,"wires":[["c810ec2b.98a9b"]]},{"id":"38df51fe.d2a8ee","type":"split","z":"392484c1.36304c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":490,"y":1180,"wires":[["d8de29be.1faf08"]]},{"id":"31be5018.92c8f","type":"switch","z":"392484c1.36304c","name":"null","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"else"}],"checkall":"true","repair":true,"outputs":2,"x":570,"y":1100,"wires":[[],["c13a0bc0.b3a008"]]},{"id":"c810ec2b.98a9b","type":"string","z":"392484c1.36304c","name":"Trim","methods":[{"name":"delLeftMost","params":[{"type":"str","value":"com.cubcadet.app:id/"}]},{"name":"trim","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":710,"y":1140,"wires":[["edfffee.c2d01"]]},{"id":"d8de29be.1faf08","type":"string","z":"392484c1.36304c","name":"Trim","methods":[{"name":"delLeftMost","params":[{"type":"str","value":"."}]},{"name":"trim","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":710,"y":1180,"wires":[["da8d6472.4da208"]]},{"id":"c13a0bc0.b3a008","type":"string","z":"392484c1.36304c","name":"Trim","methods":[{"name":"delLeftMost","params":[{"type":"str","value":"."}]},{"name":"trim","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":710,"y":1100,"wires":[["b85bebe7.918de8"]]},{"id":"edfffee.c2d01","type":"join","z":"392484c1.36304c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":860,"y":1140,"wires":[["ea110125.b30db"]]},{"id":"da8d6472.4da208","type":"join","z":"392484c1.36304c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":860,"y":1180,"wires":[["b6e11875.232e78"]]},{"id":"b85bebe7.918de8","type":"join","z":"392484c1.36304c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":860,"y":1100,"wires":[["b63074e1.2c6618"]]},{"id":"ea110125.b30db","type":"join","z":"392484c1.36304c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1150,"y":1100,"wires":[["69bf99cc.d9f858"]]},{"id":"b6e11875.232e78","type":"delay","z":"392484c1.36304c","name":"","pauseType":"delay","timeout":"50","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1180,"wires":[["ea110125.b30db"]]},{"id":"b63074e1.2c6618","type":"delay","z":"392484c1.36304c","name":"","pauseType":"delay","timeout":"25","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":1100,"wires":[["ea110125.b30db"]]},{"id":"69bf99cc.d9f858","type":"debug","z":"392484c1.36304c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1320,"y":1140,"wires":[]},{"id":"54e9a23d.c659fc","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.1.9","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

The results will end up in Home Assistant.

---

<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 August 2020 16:51 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/4 "2020-08-03T16:51:16Z")

</div>

Do you get that in one MQTT message?

Is there no way in tasker to send as JSON or other known format (anything but plain text)

My point is, the transmission format is not great for automation or ingestion by other systems - I would be surprised if you can transmit from tasker in a friendly format where there is zero requirement to split, trim, loop & join a whole bunch of data.

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 16:59 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/5 "2020-08-03T16:59:27Z")

</div>

In Tasker i'm using Auto Input which scraps the screen and that's what it gives me. I would either have to the the trimming and splitting in Tasker or in Node Red. I'm much more familiar with Node Red so that's where I'm trying to do it.  
I've managed to get the whole string into one message with each part in a separate array.

 ![Screen Shot 2020-08-03 at 10.58.40 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/632afbab9b6b603dd8c5510a00e9f87de14d588e.png)

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 17:03 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/6 "2020-08-03T17:03:16Z")

</div>

I think i've got it managed with a change node. But as you say there is probably a better way.

---

<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 August 2020 19:23 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/7 "2020-08-03T19:23:17Z")

</div>

Hi, dunno if this helps but here you go either way...

Screenshot of flow ...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3afd4a14d9658f59a72c9d2373d48b5fed3f820c.png)

The result...

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

The flow json for importing...

```auto
[{"id":"a1bf31b0.2a341","type":"function","z":"26ec3e81.85d802","name":"tasker data parser","func":"var lines = msg.payload.split(\"\\n\");\nvar section = \"\"\nvar result = { \n data: {}\n};\nvar skipHeader = false\nfor (var i = 0; i < lines.length; i++) {\n \n let line = lines[i].trim(); //get the next line\n if(!line) continue; //skip blanks\n \n if(skipHeader == false){\n if(section) {\n result[section] = line;\n section = \"\";//clear next is!\n continue\n }\n\n if(line.startsWith(\"APP NAME\")){\n section = \"APP_NAME\"\n continue\n } else if(line.startsWith(\"APP PACKAGE\")){\n section = \"APP_PACKAGE\"\n continue\n }\n }\n \n //now we expect 3 lots of data\n if(line.startsWith(\"TEXT ELEMENTS\")){\n skipHeader = true;\n section = \"TEXT_ELEMENTS\"\n continue\n } else if(line.startsWith(\"ELEMENT ID\")){\n skipHeader = true;\n section = \"ELEMENT_ID\"\n continue\n } else if(line.startsWith(\"ELEMENT COORDINATES\")){\n skipHeader = true;\n section = \"ELEMENT_COORDINATES\"\n continue\n }\n\n \n if(section && line.includes(\". \")){\n let parts = line.split(\". \") \n if(parts.length == 2){\n let el = parts[0];\n result.data[el] = result.data[el] || {};\n result.data[el][section] = parts[1];\n }\n }\n} \nmsg.payload = result;\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":560,"wires":[["2ebea0b7.94624"]]},{"id":"2ebea0b7.94624","type":"debug","z":"26ec3e81.85d802","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":560,"wires":[]}]

```

NOTE:  
This solution highly depends on the format of your data being exactly like you posted in post #3

### EDIT...

Sorry - something wrong with adding images to this post (might be my machine or forum issue)  
so this is what the data looks like after my function...

to add to your flow...

1. Copy the flow code above
2. On your node-red, open the Import (CTRL+I) dialog
3. connect your MQTT IN node to the function called `tasker data parser`

```auto
{
   "data":{
      "1":{
         "TEXT_ELEMENTS":"RC",
         "ELEMENT_ID":"com.cubcadet.app:id/robot_name_tv",
         "ELEMENT_COORDINATES":"74,154"
      },
      "2":{
         "TEXT_ELEMENTS":"SCHEDULE",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_toggle_text",
         "ELEMENT_COORDINATES":"413,286"
      },
      "3":{
         "TEXT_ELEMENTS":"Mow",
         "ELEMENT_ID":"com.cubcadet.app:id/arc",
         "ELEMENT_COORDINATES":"540,1128"
      },
      "4":{
         "TEXT_ELEMENTS":"Mow",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_start_button_text",
         "ELEMENT_COORDINATES":"279,1127"
      },
      "5":{
         "TEXT_ELEMENTS":"Help Center",
         "ELEMENT_ID":"com.cubcadet.app:id/tv_menu_text",
         "ELEMENT_COORDINATES":"496,1707"
      },
      "6":{
         "TEXT_ELEMENTS":"Menu",
         "ELEMENT_ID":"com.cubcadet.app:id/tv_menu_text",
         "ELEMENT_COORDINATES":"243,1772"
      },
      "7":{
         "TEXT_ELEMENTS":"Schedule",
         "ELEMENT_ID":"com.cubcadet.app:id/tv_menu_text",
         "ELEMENT_COORDINATES":"720,1014"
      },
      "8":{
         "TEXT_ELEMENTS":"History",
         "ELEMENT_ID":"com.cubcadet.app:id/tv_menu_text",
         "ELEMENT_COORDINATES":"768,1271"
      },
      "9":{
         "TEXT_ELEMENTS":"Manual",
         "ELEMENT_ID":"com.cubcadet.app:id/tv_menu_text",
         "ELEMENT_COORDINATES":"687,1519"
      },
      "10":{
         "TEXT_ELEMENTS":"Schedule off",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_toggle",
         "ELEMENT_COORDINATES":"652,293"
      },
      "11":{
         "TEXT_ELEMENTS":"OFF",
         "ELEMENT_ID":"com.cubcadet.app:id/custom_switch_toggle_text_off",
         "ELEMENT_COORDINATES":"692,289"
      },
      "12":{
         "TEXT_ELEMENTS":"Previous operation",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_title2",
         "ELEMENT_COORDINATES":"217,403"
      },
      "13":{
         "TEXT_ELEMENTS":"---",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_day2",
         "ELEMENT_COORDINATES":"130,504"
      },
      "14":{
         "TEXT_ELEMENTS":"--- --",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_date2",
         "ELEMENT_COORDINATES":"276,466"
      },
      "15":{
         "TEXT_ELEMENTS":"--:--",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_time2",
         "ELEMENT_COORDINATES":"270,523"
      },
      "16":{
         "TEXT_ELEMENTS":"Next operation",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_title",
         "ELEMENT_COORDINATES":"698,403"
      },
      "17":{
         "TEXT_ELEMENTS":"---",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_day",
         "ELEMENT_COORDINATES":"648,504"
      },
      "18":{
         "TEXT_ELEMENTS":"--- --",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_date",
         "ELEMENT_COORDINATES":"794,466"
      },
      "19":{
         "TEXT_ELEMENTS":"--:--",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_next_operation_text_top_time",
         "ELEMENT_COORDINATES":"788,523"
      },
      "20":{
         "TEXT_ELEMENTS":"Out of range",
         "ELEMENT_ID":"com.cubcadet.app:id/dashboard_robot_location",
         "ELEMENT_COORDINATES":"870,1880"
      }
   },
   "APP_NAME":"Cub Cadet XR 2.0",
   "APP_PACKAGE":"com.cubcadet.app"
}

```

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 19:50 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/8 "2020-08-03T19:50:59Z")

</div>

Wow that's awesome thank you. I think I ended up getting somewhere similar but it's in an array. Are object easier to work with?  
Do you know how to filter out one object out of the message?  
Like a filter that would only output the object that contains TEXT\_ELEMENTS: "Help Center"

---

<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 August 2020 19:59 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/9 "2020-08-03T19:59:38Z")

</div>

> [@JohnnyPicnic](#):
>
> Are object easier to work with?

Mostly yes. As you can pinpoint an item by hovering over it in the debug and click the copy path button.

> [@JohnnyPicnic](#):
>
> Do you know how to filter out one object out of the message

As I said above, you can address and single part of the object by using copy path.

Let me know if you need further info / don't understand something.

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 21:43 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/10 "2020-08-03T21:43:57Z")

</div>

The problem I have is that Tasker App scrapes the screen from top to bottom left to right and the information I want isn't always in the same place.  
Is there a way to filter out the object by contents?

---

<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 August 2020 21:53 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/11 "2020-08-03T21:53:27Z")

</div>

> [@JohnnyPicnic](#):
>
> Like a filter that would only output the object that contains TEXT\_ELEMENTS: "Help Center"

Is TEXT\_ELEMENT the only field you would be searching? If so, I can re-arrange the data so it becomes a KEY (and therefore becomes a simple lookup)

If you need to search other fields then I would re-arrange the data into an array & show you how to perform searches.

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [3 August 2020 21:57 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/12 "2020-08-03T21:57:38Z")

</div>

Well if I get to choose 😜 I would go with the "ELEMENT\_ID" such as "com.cubcadet.app:id/robot\_name\_tv" or just "robot\_name\_tv".

---

<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 August 2020 22:24 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/13 "2020-08-03T22:24:26Z")

</div>

Here is a slight variation...  
data gets stored as an array of objects & then saved in flow context so you can query it as you please.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e03fd9b506ef6f0494ac8525cb11a7c4568445b9.png)

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

```auto
[{"id":"77676dd3.113c74","type":"mqtt in","z":"26ec3e81.85d802","name":"","topic":"robomow/uiquery","qos":"2","datatype":"auto","broker":"74e3858f.d1884c","x":140,"y":540,"wires":[["a1bf31b0.2a341"]]},{"id":"e518f545.75c7e8","type":"inject","z":"26ec3e81.85d802","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":440,"wires":[["bf40ab44.c86b18"]]},{"id":"bf40ab44.c86b18","type":"function","z":"26ec3e81.85d802","name":"fake tasker data","func":"msg.payload = `\nAPP NAME\nCub Cadet XR 2.0\n\nAPP PACKAGE\ncom.cubcadet.app\n\nTEXT ELEMENTS - (20 TOTAL)\n1. RC\n2. SCHEDULE\n3. Mow\nnow\n4. Mow\nnow\n5. Help Center\n6. Menu\n7. Schedule\n8. History\n9. Manual\n10. Schedule off\n11. OFF\n12. Previous operation\n13. ---\n14. --- --\n15. --:--\n16. Next operation\n17. ---\n18. --- --\n19. --:--\n20. Out of range\n\nELEMENT ID's - (20 TOTAL)\n1. com.cubcadet.app:id/robot_name_tv\n2. com.cubcadet.app:id/dashboard_toggle_text\n3. com.cubcadet.app:id/arc\n4. com.cubcadet.app:id/dashboard_start_button_text\n5. com.cubcadet.app:id/tv_menu_text\n6. com.cubcadet.app:id/tv_menu_text\n7. com.cubcadet.app:id/tv_menu_text\n8. com.cubcadet.app:id/tv_menu_text\n9. com.cubcadet.app:id/tv_menu_text\n10. com.cubcadet.app:id/dashboard_toggle\n11. com.cubcadet.app:id/custom_switch_toggle_text_off\n12. com.cubcadet.app:id/dashboard_next_operation_text_top_title2\n13. com.cubcadet.app:id/dashboard_next_operation_text_day2\n14. com.cubcadet.app:id/dashboard_next_operation_text_top_date2\n15. com.cubcadet.app:id/dashboard_next_operation_text_top_time2\n16. com.cubcadet.app:id/dashboard_next_operation_text_top_title\n17. com.cubcadet.app:id/dashboard_next_operation_text_day\n18. com.cubcadet.app:id/dashboard_next_operation_text_top_date\n19. com.cubcadet.app:id/dashboard_next_operation_text_top_time\n20. com.cubcadet.app:id/dashboard_robot_location\n\nELEMENT COORDINATES - (20 TOTAL)\n1. 74,154\n2. 413,286\n3. 540,1128\n4. 279,1127\n5. 496,1707\n6. 243,1772\n7. 720,1014\n8. 768,1271\n9. 687,1519\n10. 652,293\n11. 692,289\n12. 217,403\n13. 130,504\n14. 276,466\n15. 270,523\n16. 698,403\n17. 648,504\n18. 794,466\n19. 788,523\n20. 870,1880\n`\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":440,"wires":[["acbeb561.030d58"]]},{"id":"acbeb561.030d58","type":"mqtt out","z":"26ec3e81.85d802","name":"","topic":"robomow/uiquery","qos":"","retain":"","broker":"4af1f016.58aaa","x":500,"y":440,"wires":[]},{"id":"a1bf31b0.2a341","type":"function","z":"26ec3e81.85d802","name":"tasker data parser","func":"var lines = msg.payload.split(\"\\n\");\nvar section = \"\"\nvar result = { \n data: []\n};\nvar skipHeader = false\nfor (var i = 0; i < lines.length; i++) {\n \n let line = lines[i].trim(); //get the next line\n if(!line) continue; //skip blanks\n \n if(skipHeader == false){\n if(section) {\n result[section] = line;\n section = \"\";//clear next is!\n continue\n }\n\n if(line.startsWith(\"APP NAME\")){\n section = \"APP_NAME\"\n continue\n } else if(line.startsWith(\"APP PACKAGE\")){\n section = \"APP_PACKAGE\"\n continue\n }\n }\n \n //now we expect 3 lots of data\n if(line.startsWith(\"TEXT ELEMENTS\")){\n skipHeader = true;\n section = \"TEXT_ELEMENTS\"\n continue\n } else if(line.startsWith(\"ELEMENT ID\")){\n skipHeader = true;\n section = \"ELEMENT_ID\"\n continue\n } else if(line.startsWith(\"ELEMENT COORDINATES\")){\n skipHeader = true;\n section = \"ELEMENT_COORDINATES\"\n continue\n }\n\n \n if(section && line.includes(\". \")){\n let parts = line.split(\". \") \n if(parts.length == 2){\n let el = parseInt(parts[0]);\n if(isNaN(el)) continue;\n result.data[el] = result.data[el] || {};\n result.data[el][section] = parts[1];\n }\n }\n} \nmsg.payload = result;\nreturn msg;\n","outputs":1,"noerr":0,"x":370,"y":540,"wires":[["ebf66926.a1c828"]]},{"id":"ebf66926.a1c828","type":"change","z":"26ec3e81.85d802","name":"save data in flow.uiquery","rules":[{"t":"set","p":"uiquery","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":540,"wires":[[]]},{"id":"f264fd29.29bad","type":"inject","z":"26ec3e81.85d802","name":"","topic":"","payload":"Help Center","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":640,"wires":[["5c657f2.323aa8","d1e05d0c.f58d5"]]},{"id":"5c657f2.323aa8","type":"function","z":"26ec3e81.85d802","name":"Find in uiquery.data[x].TEXT_ELEMENTS","func":"var findWhat = msg.payload.toLowerCase()\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.TEXT_ELEMENTS ) return null;\n return e.TEXT_ELEMENTS.toLowerCase().includes(findWhat)\n})\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"x":420,"y":640,"wires":[["97179d94.d7bac"]]},{"id":"97179d94.d7bac","type":"debug","z":"26ec3e81.85d802","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":640,"wires":[]},{"id":"f0bc840c.e555a8","type":"inject","z":"26ec3e81.85d802","name":"","topic":"","payload":"Schedule","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":680,"wires":[["5c657f2.323aa8","d1e05d0c.f58d5"]]},{"id":"d1e05d0c.f58d5","type":"function","z":"26ec3e81.85d802","name":"Find in uiquery.data[x].ELEMENT_ID","func":"var findWhat = msg.payload.toLowerCase()\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"x":410,"y":680,"wires":[["53c609ed.7428b8"]]},{"id":"7445f149.07f49","type":"inject","z":"26ec3e81.85d802","name":"","topic":"","payload":"tv_menu_text","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":720,"wires":[["d1e05d0c.f58d5","5c657f2.323aa8"]]},{"id":"53c609ed.7428b8","type":"debug","z":"26ec3e81.85d802","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":680,"wires":[]},{"id":"705dc2c9.5d5b9c","type":"comment","z":"26ec3e81.85d802","name":"1. Turn text into object and data array - then store it in flow context","info":"","x":290,"y":500,"wires":[]},{"id":"86080a5e.d14308","type":"comment","z":"26ec3e81.85d802","name":"2. Two different routines that search different properties of the array of objects stored in flow context","info":"","x":400,"y":600,"wires":[]},{"id":"93c27deb.e6caf","type":"comment","z":"26ec3e81.85d802","name":"Faking it :)","info":"","x":120,"y":400,"wires":[]},{"id":"74e3858f.d1884c","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4af1f016.58aaa","type":"mqtt-broker","z":"","name":"aedes local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"40","cleansession":true,"birthTopic":"aedes/state","birthQos":"0","birthPayload":"ready","closeTopic":"aedes/state","closeQos":"0","closePayload":"alert","willTopic":"aedes/state","willQos":"0","willPayload":"alert"}]

```

---

<div class="post-metadata">

**Author:** ![JohnnyPicnic](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johnnypicnic/32/34787_2.png) [@JohnnyPicnic](https://discourse.nodered.org/u/JohnnyPicnic)\
**Post date:** [6 August 2020 01:37 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/14 "2020-08-06T01:37:38Z")

</div>

Thanks again for your help! Here is what I ended up doing with the flows you made:

 ![Screen Shot 2020-08-05 at 7.28.07 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/316c6420634bb7942a7bb5d451b7ba448ebddfa0.png)

```auto
[{"id":"d09614e2.aa32f8","type":"mqtt in","z":"392484c1.36304c","name":"","topic":"robomow/uiquery","qos":"2","datatype":"auto","broker":"54e9a23d.c659fc","x":190,"y":360,"wires":[["3b04ea2a.77c096"]]},{"id":"3b04ea2a.77c096","type":"function","z":"392484c1.36304c","name":"tasker data parser","func":"var lines = msg.payload.split(\"\\n\");\nvar section = \"\"\nvar result = { \n data: []\n};\nvar skipHeader = false\nfor (var i = 0; i < lines.length; i++) {\n \n let line = lines[i].trim(); //get the next line\n if(!line) continue; //skip blanks\n \n if(skipHeader == false){\n if(section) {\n result[section] = line;\n section = \"\";//clear next is!\n continue\n }\n\n if(line.startsWith(\"APP NAME\")){\n section = \"APP_NAME\"\n continue\n } else if(line.startsWith(\"APP PACKAGE\")){\n section = \"APP_PACKAGE\"\n continue\n }\n }\n \n //now we expect 3 lots of data\n if(line.startsWith(\"TEXT ELEMENTS\")){\n skipHeader = true;\n section = \"TEXT_ELEMENTS\"\n continue\n } else if(line.startsWith(\"ELEMENT ID\")){\n skipHeader = true;\n section = \"ELEMENT_ID\"\n continue\n } else if(line.startsWith(\"ELEMENT COORDINATES\")){\n skipHeader = true;\n section = \"ELEMENT_COORDINATES\"\n continue\n }\n\n \n if(section && line.includes(\". \")){\n let parts = line.split(\". \") \n if(parts.length == 2){\n let el = parseInt(parts[0]);\n if(isNaN(el)) continue;\n result.data[el] = result.data[el] || {};\n result.data[el][section] = parts[1];\n }\n }\n} \nmsg.payload = result;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":360,"wires":[["52ce1aa3.188564","253e57ef.97d4c8"]]},{"id":"52ce1aa3.188564","type":"change","z":"392484c1.36304c","name":"save data in flow.uiquery","rules":[{"t":"set","p":"uiquery","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":360,"wires":[["5592e283.c634dc","cb52d47f.49ccd8","e7125316.02f1e","c62a67a.79c1f98","24964170.55bfee","a8ea5f19.119cd","9d94a9df.65f708"]]},{"id":"253e57ef.97d4c8","type":"debug","z":"392484c1.36304c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":390,"y":280,"wires":[]},{"id":"5592e283.c634dc","type":"function","z":"392484c1.36304c","name":"robot_name_tv","func":"var findWhat = \"robot_name_tv\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":220,"y":480,"wires":[[]]},{"id":"cb52d47f.49ccd8","type":"function","z":"392484c1.36304c","name":"mow_duration","func":"var findWhat = \"mow_duration\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":220,"y":740,"wires":[["8ac62bef.269ce8"]]},{"id":"e7125316.02f1e","type":"function","z":"392484c1.36304c","name":"dashboard_start_button_text","func":"var findWhat = \"dashboard_start_button_text\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":250,"y":820,"wires":[[]]},{"id":"c62a67a.79c1f98","type":"function","z":"392484c1.36304c","name":"dashboard_robot_location","func":"var findWhat = \"dashboard_robot_location\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":570,"wires":[["63b8d0ed.9a8d2"]]},{"id":"24964170.55bfee","type":"function","z":"392484c1.36304c","name":"battery_percentage_display","func":"var findWhat = \"battery_percentage_display\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":260,"y":520,"wires":[["54572aae.09fc04"]]},{"id":"a8ea5f19.119cd","type":"function","z":"392484c1.36304c","name":"tv_popup_title","func":"var findWhat = \"tv_popup_title\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":210,"y":860,"wires":[["3097a72a.915948"]]},{"id":"9d94a9df.65f708","type":"function","z":"392484c1.36304c","name":"custom_switch_toggle_text_off","func":"var findWhat = \"custom_switch_toggle_text_off\"\nvar uiquery = flow.get(\"uiquery\");\nvar filtered = uiquery.data.filter(e => {\n if(!e || !e.ELEMENT_ID ) return null;\n return e.ELEMENT_ID.toLowerCase().includes(findWhat)\n})\n\n\nif(!filtered || !filtered.length) \n return null;//halt the flow - nothing found\n\n//something was found - nice, put it in msg.payload & send it on\nmsg.payload = filtered;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":670,"wires":[["ff045816.d70d48"]]},{"id":"8ac62bef.269ce8","type":"change","z":"392484c1.36304c","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].TEXT_ELEMENTS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":740,"wires":[["e7705a07.ef3318"]]},{"id":"63b8d0ed.9a8d2","type":"change","z":"392484c1.36304c","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].TEXT_ELEMENTS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":570,"wires":[["65eec65b.b8cf28"]]},{"id":"54572aae.09fc04","type":"change","z":"392484c1.36304c","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].TEXT_ELEMENTS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":520,"wires":[["d1f91764.270958"]]},{"id":"3097a72a.915948","type":"change","z":"392484c1.36304c","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"click","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":860,"wires":[["305a87c.f15a378"]]},{"id":"ff045816.d70d48","type":"change","z":"392484c1.36304c","name":"set payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].TEXT_ELEMENTS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":670,"wires":[["9fd8bdf1.1d392"]]},{"id":"e7705a07.ef3318","type":"ha-entity","z":"392484c1.36304c","name":"Runtime","server":"cbbf6ce3.4f5eb","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Robomow Runtime"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":750,"y":740,"wires":[[]]},{"id":"65eec65b.b8cf28","type":"ha-entity","z":"392484c1.36304c","name":"State","server":"cbbf6ce3.4f5eb","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Robomow"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":740,"y":570,"wires":[[]]},{"id":"d1f91764.270958","type":"string","z":"392484c1.36304c","name":"%","methods":[{"name":"stripPunctuation","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":630,"y":520,"wires":[["40918be3.e5c0c4"]]},{"id":"305a87c.f15a378","type":"mqtt out","z":"392484c1.36304c","name":"","topic":"robomow/tv_popup_title/click","qos":"","retain":"","broker":"54e9a23d.c659fc","x":690,"y":860,"wires":[]},{"id":"9fd8bdf1.1d392","type":"ha-entity","z":"392484c1.36304c","name":"Schedule","server":"cbbf6ce3.4f5eb","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Robomow Schedule"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":750,"y":670,"wires":[[]]},{"id":"40918be3.e5c0c4","type":"ha-entity","z":"392484c1.36304c","name":"Battery","server":"cbbf6ce3.4f5eb","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Robomow Battery"},{"property":"device_class","value":"battery"},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"%"}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":750,"y":520,"wires":[[]]},{"id":"93c0c08e.22ab9","type":"inject","z":"392484c1.36304c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":940,"wires":[["305a87c.f15a378"]]},{"id":"54e9a23d.c659fc","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.1.9","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cbbf6ce3.4f5eb","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

```

---

<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:** [20 August 2020 01:37 UTC](https://discourse.nodered.org/t/combine-two-arrays-based-on-line-number/31071/15 "2020-08-20T01:37:55Z")

</div>

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