# How to select specific item from data

**URL:** https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408
**Category:** General
**Created:** [21 July 2022 08:57 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408 "2022-07-21T08:57:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 08:57 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/1 "2022-07-21T08:57:51Z")

</div>

Hello. Sorry for my English. Help with my case.

I'm receiving data and I need to select exactly the one that starts with 11.. and has 8 message length. Other messages I want to filter out because I don't need them

```auto
[{"id":"659072b9062a8732","type":"mqtt in","z":"8aa7b0bce24442b3","name":"V","topic":"V","qos":"0","datatype":"auto","broker":"16761018a3f73c6d","nl":false,"rap":true,"rh":0,"inputs":0,"x":230,"y":140,"wires":[["c8bec1d663babd82"]]},{"id":"c8bec1d663babd82","type":"json","z":"8aa7b0bce24442b3","name":"V","property":"payload","action":"","pretty":false,"x":370,"y":140,"wires":[["002bc045dba2b155","a0f27ab6e1cce408","22149e675338d9e8"]]},{"id":"002bc045dba2b155","type":"debug","z":"8aa7b0bce24442b3","name":"V","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":80,"wires":[]},{"id":"83613ea3ea6b22a7","type":"debug","z":"8aa7b0bce24442b3","name":"13","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":260,"wires":[]},{"id":"a0f27ab6e1cce408","type":"string","z":"8aa7b0bce24442b3","name":"length() выдает длину сторки ","methods":[{"name":"length","params":[]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":690,"y":260,"wires":[["83613ea3ea6b22a7","64970f1fc536c669"]]},{"id":"b77e90e8bfdf97ad","type":"debug","z":"8aa7b0bce24442b3","name":"15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":140,"wires":[]},{"id":"64970f1fc536c669","type":"change","z":"8aa7b0bce24442b3","name":"Set flow.state","rules":[{"t":"set","p":"state","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":200,"wires":[["6a44075f311d22fd"]]},{"id":"6a44075f311d22fd","type":"debug","z":"8aa7b0bce24442b3","name":"17","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1150,"y":240,"wires":[]},{"id":"22149e675338d9e8","type":"switch","z":"8aa7b0bce24442b3","name":"Context based routing","property":"state","propertyType":"global","rules":[{"t":"lt","v":"8","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":880,"y":140,"wires":[["b77e90e8bfdf97ad"]]},{"id":"16761018a3f73c6d","type":"mqtt-broker","name":"105j","broker":"192.168.4.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:08 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/2 "2022-07-21T09:08:41Z")

</div>

I am not sure what you posted will help.

What you need to post is the message (as you call it _data_) so others can look at it and show you how to do what you need.

(Poor analogy)  
What you have posted is a bad painting and you are asking about the brushes to use.

Put a `DEBUG` node on the `MQTT IN` node (set to show COMPLETE MSG OBJECT)

![Screenshot from 2022-07-21 19-07-49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c237f5734fe4af9a67763649759256e482a8947.png)

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:10 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/3 "2022-07-21T09:10:16Z")

</div>

![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55568304acadd95be625c6593d0c9026b0793554.png)  
 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd957d97046024c37d5840fad5eff9bd9e72912c.png)

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:14 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/4 "2022-07-21T09:14:09Z")

</div>

I am having difficulty solving this problem.

---

<div class="post-metadata">

### Author: ![3dimensional](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/3dimensional/32/64992_2.png) [@3dimensional](https://discourse.nodered.org/u/3dimensional)
#### Post date: [21 July 2022 09:15 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/5 "2022-07-21T09:15:25Z")

</div>

Hi, may this will help you:

```auto
[{"id":"fabeea6bbea43070","type":"tab","label":"NodeRED Forum","disabled":false,"info":"","env":[]},{"id":"720c666f865b3362","type":"tab","label":"NodeRED Forum","disabled":false,"info":"","env":[]},{"id":"16761018a3f73c6d","type":"mqtt-broker","name":"105j","broker":"0.0.0.0","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"b35eecd9bd46b63b","type":"inject","z":"fabeea6bbea43070","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":2760,"wires":[["43a8df33999deb21"]]},{"id":"8ae7850eadaf7857","type":"http request","z":"fabeea6bbea43070","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/search","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":410,"y":2760,"wires":[["a671be3fb3d0b9ad"]]},{"id":"43a8df33999deb21","type":"function","z":"fabeea6bbea43070","name":"","func":"msg.payload = {\n \"jql\": \"project = TEST AND issuetype = Offer AND status NOT IN ('Done')\",\n \"maxResults\": 99999,\n \"fieldsByKeys\": false,\n \"fields\": [\n \"subtasks\",\n \"issuelinks\"\n],\n \"startAt\": 0\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":2760,"wires":[["8ae7850eadaf7857"]]},{"id":"8618f290272db363","type":"debug","z":"fabeea6bbea43070","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1970,"y":3060,"wires":[]},{"id":"a671be3fb3d0b9ad","type":"json","z":"fabeea6bbea43070","name":"","property":"payload","action":"","pretty":false,"x":550,"y":2760,"wires":[["8618f290272db363","579705a5e6ebdf01"]]},{"id":"91aff4d75bcc9aff","type":"comment","z":"fabeea6bbea43070","name":"Get all billable offers","info":"","x":150,"y":2720,"wires":[]},{"id":"579705a5e6ebdf01","type":"switch","z":"fabeea6bbea43070","name":"","property":"payload.issues","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":2760,"wires":[["bc517ab3d7d0aa7a"]]},{"id":"bc517ab3d7d0aa7a","type":"function","z":"fabeea6bbea43070","name":"","func":"var issues = [];\nmsg.payload.issues.forEach(function(issue, i){\n issues.push(issue);\n});\nmsg.payload = issues;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":2760,"wires":[["801661c0be1b62a1"]]},{"id":"801661c0be1b62a1","type":"split","z":"fabeea6bbea43070","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":930,"y":2760,"wires":[["8b1afb9e17039617"]]},{"id":"8b1afb9e17039617","type":"switch","z":"fabeea6bbea43070","name":"","property":"payload.fields.subtasks","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":1050,"y":2760,"wires":[["fc5971ce78d630e0"]]},{"id":"fc5971ce78d630e0","type":"function","z":"fabeea6bbea43070","name":"","func":"msg.payload = {\n \"jql\": \"project = TEST AND issuekey IN ('TEST-7', 'TEST-8', 'TEST-9')\",\n \"maxResults\": 99999,\n \"fieldsByKeys\": false,\n \"fields\": [\n \"worklog\",\n \"parent\"\n],\n \"startAt\": 0\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":2760,"wires":[["141e66b8ea8c5e0a"]]},{"id":"141e66b8ea8c5e0a","type":"http request","z":"fabeea6bbea43070","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/search","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":1330,"y":2760,"wires":[["4312971efb6ffb20"]]},{"id":"4312971efb6ffb20","type":"json","z":"fabeea6bbea43070","name":"","property":"payload","action":"","pretty":false,"x":1470,"y":2760,"wires":[["8618f290272db363","bb4f1492ebc6f211"]]},{"id":"d42cf7b863eba505","type":"switch","z":"fabeea6bbea43070","name":"","property":"payload.issues","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":1590,"y":2760,"wires":[["bb4f1492ebc6f211"]]},{"id":"bb4f1492ebc6f211","type":"function","z":"fabeea6bbea43070","name":"","func":"var timeSpent = 0;\nvar issueKey = \"\";\n\nmsg.payload.issues.forEach(function(issue, i){\n if(issue.fields.hasOwnProperty('worklog') && issue.fields.worklog.total > 0){\n issue.fields.worklog.worklogs.forEach(function(worklog, n){\n timeSpent += worklog.timeSpentSeconds;\n });\n }\n issueKey = issue.fields.parent.key;\n});\n\nmsg.payload = {\n \"body\": {\n \"version\": 1,\n \"type\": \"doc\",\n \"content\": [\n {\n \"type\": \"paragraph\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Time Spent: \" + (timeSpent/60/60) + \"h\"\n }\n]\n }\n ]\n },\n \"visibility\": {\n \"type\": \"role\",\n \"value\": \"Project Manager\"\n }\n}\nconsole.log();\nmsg.issueKey = issueKey;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1720,"y":2760,"wires":[["a3da851051164a6e"]]},{"id":"a3da851051164a6e","type":"http request","z":"fabeea6bbea43070","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/issue/{{issueKey}}/comment","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":1870,"y":2760,"wires":[["8618f290272db363"]]},{"id":"28e4b1744bde2020","type":"inject","z":"fabeea6bbea43070","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11000000","payloadType":"str","x":520,"y":360,"wires":[["a47a070790099e4a"]]},{"id":"a47a070790099e4a","type":"function","z":"fabeea6bbea43070","name":"Process Message Calculation","func":"var payload = msg.payload;\nvar processMessage = (payload.toString().startsWith('11') && payload.length === 8) ?? false;\nmsg.processMessage = processMessage;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":360,"wires":[["f6268720a6d89571"]]},{"id":"f6268720a6d89571","type":"switch","z":"fabeea6bbea43070","name":"Process Message?","property":"processMessage","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":970,"y":360,"wires":[["fd690c2ff0bb5c69"]]},{"id":"fd690c2ff0bb5c69","type":"debug","z":"fabeea6bbea43070","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1150,"y":360,"wires":[]},{"id":"ddf5934525261467","type":"inject","z":"720c666f865b3362","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":2760,"wires":[["be354fd5e012f971"]]},{"id":"1b1c8910dcf7598c","type":"http request","z":"720c666f865b3362","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/search","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":410,"y":2760,"wires":[["006a5ec6c34d08ea"]]},{"id":"be354fd5e012f971","type":"function","z":"720c666f865b3362","name":"","func":"msg.payload = {\n \"jql\": \"project = TEST AND issuetype = Offer AND status NOT IN ('Done')\",\n \"maxResults\": 99999,\n \"fieldsByKeys\": false,\n \"fields\": [\n \"subtasks\",\n \"issuelinks\"\n],\n \"startAt\": 0\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":2760,"wires":[["1b1c8910dcf7598c"]]},{"id":"6cd5bc92f56045e9","type":"debug","z":"720c666f865b3362","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1970,"y":3060,"wires":[]},{"id":"006a5ec6c34d08ea","type":"json","z":"720c666f865b3362","name":"","property":"payload","action":"","pretty":false,"x":550,"y":2760,"wires":[["6cd5bc92f56045e9","9908853c6858de87"]]},{"id":"5be3f555c08c62aa","type":"comment","z":"720c666f865b3362","name":"Get all billable offers","info":"","x":150,"y":2720,"wires":[]},{"id":"9908853c6858de87","type":"switch","z":"720c666f865b3362","name":"","property":"payload.issues","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":2760,"wires":[["8bf94551e0c57e3f"]]},{"id":"8bf94551e0c57e3f","type":"function","z":"720c666f865b3362","name":"","func":"var issues = [];\nmsg.payload.issues.forEach(function(issue, i){\n issues.push(issue);\n});\nmsg.payload = issues;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":2760,"wires":[["48dc5a8bd5f0153c"]]},{"id":"48dc5a8bd5f0153c","type":"split","z":"720c666f865b3362","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":930,"y":2760,"wires":[["fb262a081492cc26"]]},{"id":"fb262a081492cc26","type":"switch","z":"720c666f865b3362","name":"","property":"payload.fields.subtasks","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":1050,"y":2760,"wires":[["e4a462779b67f1a2"]]},{"id":"e4a462779b67f1a2","type":"function","z":"720c666f865b3362","name":"","func":"msg.payload = {\n \"jql\": \"project = TEST AND issuekey IN ('TEST-7', 'TEST-8', 'TEST-9')\",\n \"maxResults\": 99999,\n \"fieldsByKeys\": false,\n \"fields\": [\n \"worklog\",\n \"parent\"\n],\n \"startAt\": 0\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":2760,"wires":[["6bb2294b4aa08735"]]},{"id":"6bb2294b4aa08735","type":"http request","z":"720c666f865b3362","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/search","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":1330,"y":2760,"wires":[["77320646942dd3f6"]]},{"id":"77320646942dd3f6","type":"json","z":"720c666f865b3362","name":"","property":"payload","action":"","pretty":false,"x":1470,"y":2760,"wires":[["6cd5bc92f56045e9","83dc554b0211d03b"]]},{"id":"aa58516be44b4e1f","type":"switch","z":"720c666f865b3362","name":"","property":"payload.issues","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":1590,"y":2760,"wires":[["83dc554b0211d03b"]]},{"id":"83dc554b0211d03b","type":"function","z":"720c666f865b3362","name":"","func":"var timeSpent = 0;\nvar issueKey = \"\";\n\nmsg.payload.issues.forEach(function(issue, i){\n if(issue.fields.hasOwnProperty('worklog') && issue.fields.worklog.total > 0){\n issue.fields.worklog.worklogs.forEach(function(worklog, n){\n timeSpent += worklog.timeSpentSeconds;\n });\n }\n issueKey = issue.fields.parent.key;\n});\n\nmsg.payload = {\n \"body\": {\n \"version\": 1,\n \"type\": \"doc\",\n \"content\": [\n {\n \"type\": \"paragraph\",\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Time Spent: \" + (timeSpent/60/60) + \"h\"\n }\n]\n }\n ]\n },\n \"visibility\": {\n \"type\": \"role\",\n \"value\": \"Project Manager\"\n }\n}\nconsole.log();\nmsg.issueKey = issueKey;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1720,"y":2760,"wires":[["1665f1ba228211fc"]]},{"id":"1665f1ba228211fc","type":"http request","z":"720c666f865b3362","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://y1digital.atlassian.net/rest/api/3/issue/{{issueKey}}/comment","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"x":1870,"y":2760,"wires":[["6cd5bc92f56045e9"]]},{"id":"e2af714068f8f0bd","type":"inject","z":"720c666f865b3362","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11000000","payloadType":"str","x":520,"y":360,"wires":[["8ee35e4d90966133"]]},{"id":"8ee35e4d90966133","type":"function","z":"720c666f865b3362","name":"Process Message Calculation","func":"var payload = msg.payload;\nvar processMessage = (payload.toString().startsWith('Sein oder') && payload.length === 8) ?? false;\nmsg.processMessage = processMessage;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":360,"wires":[["83be36dc1c117c36"]]},{"id":"83be36dc1c117c36","type":"switch","z":"720c666f865b3362","name":"Process Message?","property":"processMessage","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":970,"y":360,"wires":[["d91ff19181e36fc7"]]},{"id":"d91ff19181e36fc7","type":"debug","z":"720c666f865b3362","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1150,"y":360,"wires":[]}]

```

Changed flow function since payload is nummeric.

Cheers

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:21 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/6 "2022-07-21T09:21:04Z")

</div>

Nearly.....

Put the `DEBUG` directly onto the `MQTT IN` node, set it as I showed above and then open the message (in the right column) and paste the actual TEXT here.

It is not easy looking at the screen shot.

To get the message:  
Look for the output in the right colum.... (example)

![Screenshot from 2022-07-21 19-16-19](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/32154749ac37e82b886846239ed76a170bdb7828.png)

Expand the message by clicking on the little triangle.

![Screenshot from 2022-07-21 19-16-24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/ad5cba259714dcb89b130108daff0686d8438cbc.png)

![Screenshot from 2022-07-21 19-16-30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/771e271a4c239dd425b69b086f8ee07736fb6e9c.png)

Then open the `payload` part by clicking on the triangle.

Then click on the `clipboard` icon (second red arrow/line)

Paste it here.  
It won't be perfect, but it will get things started.

---

<div class="post-metadata">

### Author: ![3dimensional](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/3dimensional/32/64992_2.png) [@3dimensional](https://discourse.nodered.org/u/3dimensional)
#### Post date: [21 July 2022 09:22 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/7 "2022-07-21T09:22:59Z")

</div>

Edited the flow, had some errors in it ;). Damn copy&paste script kiddy 😃

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:26 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/8 "2022-07-21T09:26:12Z")

</div>

![5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/586357d79c0611dd1fedad78b5eff85f9c287b83.png)  
Uploading: 6.png...

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:27 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/9 "2022-07-21T09:27:25Z")

</div>

I need to filter from 4 messages to get the first payload: "11714368", and filter out the rest: payload: "0", payload: "156379059".

 ![6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a0d27679f8dbc489903a015475979817e896ec73.png)  
I can’t beautifully copy the result like you have in a column.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:32 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/10 "2022-07-21T09:32:02Z")

</div>

```auto
payload: "11714368"
qos: 0
retain: false
_msgid: "3eb25d3eaa0f190f"
21.07.2022, 18:25:28[node: 4](http://127.0.0.1:1880/#)V : msg : Object
object
topic: "V"

```

So that is the part in which you are interested - yes?

(Progress is being made but only slow)

Now, let's try again (nothing against you) but this time JUST BEFORE you post:  
To the left of the `1` key (top left) is the ` key

Press it 3 times then press enter.  
Paste the stuff you got from the flow.  
On the next line press that key 3 times again.

You will see in the _Preview window_ (to the right) you will see it looks like what I just posted.  
(Or similar)

Could you now please do that?  
Thanks.

# ACTUALLY!

Go back and EDIT the previous post.  
You are limited to how many posts you can make when you are new.

Edit the post by clicking on the PENCIL icon at the bottom of your post.

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:34 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/11 "2022-07-21T09:34:57Z")

</div>

```auto
{"topic":"V","payload":"0","qos":0,"retain":false,"_msgid":"fa66daebd8691e5a"}{"topic":"V","payload":"156379059","qos":0,"retain":false,"_msgid":"033db903b34af86b"}{"topic":"V","payload":"0","qos":0,"retain":false,"_msgid":"41bdfaaf3cac933a"}

```

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:40 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/12 "2022-07-21T09:40:13Z")

</div>

Ok,

I'm confused.

That is a whole new message not the one you already posted... Just wanting to check.

None of those messages meet your needs, so I'm confused.

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:43 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/13 "2022-07-21T09:43:37Z")

</div>

I need to filter from 4 messages to get the first payload: "11714368", and filter out the rest: payload: "0", payload: "156379059".

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:43 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/14 "2022-07-21T09:43:39Z")

</div>

In one of your posts, (number 9) there seems to be 3 messages there.  
Your post (number 7) is one message.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:46 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/15 "2022-07-21T09:46:24Z")

</div>

Ok, so you always get 4 messages.....

It wouldn't be always the first one you want, as that would be too easy.

_Who/What_ is sending these messages?

The problem I can see is the `payload` (which is that which you are wanting to detect) is a number and it may be tricky to _match_.  
Is it's length always the same?  
Like `11xxxxxx`  
Or can it be longer/shorter?

> [@tsuratolya](#):
>
> from 4 messages to get the first payload: "11714368",

But I only see 3 messages there.  
(But anyway)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:52 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/16 "2022-07-21T09:52:46Z")

</div>

If/when you edit the post, don't delete the old stuff.

It may be handy for people (me) to go back to, and is still should/would/could be relevant.

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 09:53 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/17 "2022-07-21T09:53:46Z")

</div>

The length of this message is the same; it is the code of the infrared remote control of the air conditioner. I want to receive it. Also, I get a line like (Mesg Desc.: Power: On, Mode: 0 (Cool), Fan: 5 (Auto), Temp: 24C, Zone Follow: Off, Sensor Temp: Off). And since I have a lot of these records. I want to record codes and entries and then use them to control the air conditioner.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 09:54 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/18 "2022-07-21T09:54:19Z")

</div>

Ok, hang on..... I'll show you something shortly.

---

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [21 July 2022 10:00 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/19 "2022-07-21T10:00:15Z")

</div>

The problem with Nodier-red is that I can't manipulate the conditions flexibly. It would seem a simple action to put a condition on another event or filter, I have to dig a lot of videos and literature. A simple action, but it doesn't work.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 July 2022 10:01 UTC](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408/20 "2022-07-21T10:01:26Z")

</div>

Try this bit of code.

I've included an extra `debug` only to help you see what is going on.

Replace the `INJECT` node with the `MQTT IN` node.  
The `WANTED` debug node is what you will connect to to get the next thing happening.

```auto
[{"id":"3da047291d2d65d0","type":"inject","z":"e43e3902.57c4e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11714368","payloadType":"num","x":130,"y":370,"wires":[["602b1d912c7a4958"]]},{"id":"602b1d912c7a4958","type":"switch","z":"e43e3902.57c4e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"11000000","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":270,"y":370,"wires":[["6be735273cfab3ff"],["5dd965fe633160aa"]]},{"id":"6be735273cfab3ff","type":"switch","z":"e43e3902.57c4e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"12000000","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":370,"wires":[["0110c7af1cacd1f2"],["5dd965fe633160aa"]]},{"id":"5dd965fe633160aa","type":"debug","z":"e43e3902.57c4e8","name":"Rejected","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":430,"wires":[]},{"id":"0110c7af1cacd1f2","type":"debug","z":"e43e3902.57c4e8","name":"WANTED","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":580,"y":370,"wires":[]}]

```

(What to do)  
Move your mouse up to the _box_ above with the code.  
Move to the right and you will see a `clipboard` icon appear. (Just to the right of it is an _expand_ icon)  
Click on the `clipboard` icon.

Go to Node-Red.  
Click the Menu button.  
Import.  
Paste the code in the box/area that opens.  
Then you will see the `IMPORT` button (bottom right) turn RED.  
Click it.

You will get the code I wrote.

Hope that helps.

[Next page](https://discourse.nodered.org/t/how-to-select-specific-item-from-data/65408.md?page=2)
