# Help manipulating data inside an array

**URL:** <https://discourse.nodered.org/t/help-manipulating-data-inside-an-array/21348>\
**Category:** General\
**Created:** [6 February 2020 12:24 UTC](https://discourse.nodered.org/t/help-manipulating-data-inside-an-array/21348 "2020-02-06T12:24:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![redlop](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@redlop](https://discourse.nodered.org/u/redlop)\
**Post date:** [6 February 2020 12:24 UTC](https://discourse.nodered.org/t/help-manipulating-data-inside-an-array/21348/1 "2020-02-06T12:24:41Z")

</div>

Im working on a project that sniffs nearby WiFi networks. How do I insert a conditional statement in a nested json array to output approximate distance based on RSSI value. Currently I can print out the RSSI and SSID of nearby networks.

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

This is what it looks like. I want to get rid of the table on the right side and print it immediately with these conditions

if (RSSI \> -40) {  
meters = 1;  
} else if (RSSI \<= -41 & RSSI \>= -51) {  
meters = 1.5;  
} else if (RSSI \<= -52 & RSSI \>= -62) {  
meters = 2;  
} else if (RSSI \<= -63 & RSSI \>= -73) {  
meters = 2.5;  
} else if (RSSI \<= -74 & RSSI \>= -84) {  
meters = 3;  
} else if (RSSI \<= -75 & RSSI \>= -85) {  
meters = 3.5;  
} else if (RSSI \<= -86 & RSSI \>= -100) {  
meters = 4;  
} else {  
meters = 5;  
}

```auto
[{"id":"f63156ff.1a0148","type":"tab","label":"RSSI","disabled":false,"info":""},{"id":"c8396642.6f7ac8","type":"mqtt in","z":"f63156ff.1a0148","name":"RSSI Sniffer","topic":"rssi/test","qos":"1","datatype":"auto","broker":"295202a1.7626ae","x":350,"y":320,"wires":[["37c1013f.94e86e"]]},{"id":"37c1013f.94e86e","type":"json","z":"f63156ff.1a0148","name":"jsonconversion","property":"payload","action":"obj","pretty":false,"x":660,"y":240,"wires":[["9f9b613e.b58cc"]]},{"id":"5d058e63.9a52e","type":"ui_template","z":"f63156ff.1a0148","group":"38ef9235.21dd1e","name":"","order":1,"width":"8","height":"8","format":"<table class=\"ng-scope\" style=\"color: rgb(17, 17, 17); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; height: 156px; width: 430px;\">\n <tbody>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">Less than -40</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(51, 153, 102);\">1m range&nbsp;</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">-40 to -51</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(153, 204, 0);\">1.5m range</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">-52 to -62</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(41, 105, 176);\">2m range</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">-63 to -73</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(255, 255, 0);\">2.5m range</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">-74 to -84</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(255, 153, 0);\">3m range</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">-75 to -85</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(255, 102, 0);\">3.5m range</span></h2>\n </td>\n </tr>\n <tr>\n <td style=\"width: 64.186%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(128, 128, 128);\">&nbsp;-86 and above</span></h2>\n </td>\n <td style=\"width: 35.5814%;\">\n <h2 style=\"margin: 0.3em 0px;\"><span style=\"color: rgb(255, 0, 0);\">4m above</span></h2>\n </td>\n </tr>\n </tbody>\n</table>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":800,"y":400,"wires":[[]]},{"id":"224cd04a.ca438","type":"ui_template","z":"f63156ff.1a0148","group":"89bcaf75.fdca","name":"","order":0,"width":"8","height":"9","format":"<h1>RSSI Readings</h1>\n<h1><ul>\n <li ng-repeat=\"x in msg.payload\">\n <span>{{x.SSID}}: {{x.RSSI}}</span>\n </li>\n</ul></h1>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1020,"y":240,"wires":[[]]},{"id":"c2b9326c.964fc","type":"debug","z":"f63156ff.1a0148","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":990,"y":360,"wires":[]},{"id":"9f9b613e.b58cc","type":"function","z":"f63156ff.1a0148","name":"","func":"msg.payload = msg.payload.Networks.filter(el => el.SSID.includes(\"ARSARO_\"))\nreturn msg","outputs":1,"noerr":0,"x":790,"y":300,"wires":[["c2b9326c.964fc","224cd04a.ca438"]]},{"id":"295202a1.7626ae","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"38ef9235.21dd1e","type":"ui_group","z":"","name":"Rssi in Meters","tab":"609e67a4.396668","order":2,"disp":true,"width":"8","collapse":false},{"id":"89bcaf75.fdca","type":"ui_group","z":"","name":"rssi","tab":"609e67a4.396668","order":1,"disp":false,"width":"8","collapse":false},{"id":"609e67a4.396668","type":"ui_tab","z":"","name":"Home","icon":"mic","disabled":false,"hidden":false}]

```

this is my flow

---

<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:** [6 April 2020 12:24 UTC](https://discourse.nodered.org/t/help-manipulating-data-inside-an-array/21348/2 "2020-04-06T12:24:43Z")

</div>

Closed on 6 April 2020 12:24 UTC

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