# How to seperate value from incoming msg.payload?

**URL:** <https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287>\
**Category:** Dashboard\
**Created:** [22 May 2018 07:46 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287 "2018-05-22T07:46:10Z")\
**Posts on this page:** 14\
**Page:** 3

<div class="post-metadata">

**Author:** ![Madhumati](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Madhumati](https://discourse.nodered.org/u/Madhumati)\
**Post date:** [8 June 2018 08:21 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/41 "2018-06-08T08:21:19Z")

</div>

Hello,

I have now another flow where I want to make Dashboard through Gauge display, but same issue I am facing, -- I am not able to seperate out the payload value to send to gauge dispaly....below is simple flow through change node --but it is not working here ---Do I need to add here some function to sepearte out value?

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

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

below is the complete msg receved from Input node

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

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [8 June 2018 08:52 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/42 "2018-06-08T08:52:53Z")

</div>

You should make

set to: msg.payload  
msg.payload.value

or directly on the gauge {{msg.payload.value}} without this change node

Regards

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [8 June 2018 09:16 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/43 "2018-06-08T09:16:43Z")

</div>

There’s also a great guide at [https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)  
which shows you how to work out the route to any item in the msg object

---

<div class="post-metadata">

**Author:** ![Madhumati](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Madhumati](https://discourse.nodered.org/u/Madhumati)\
**Post date:** [8 June 2018 09:53 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/44 "2018-06-08T09:53:32Z")

</div>

This also not working

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

the value is not linked to gauge value

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [8 June 2018 10:01 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/45 "2018-06-08T10:01:36Z")

</div>

I assume when doing it like that you have wired the input node directly to the gauche whithout any change node right?

---

<div class="post-metadata">

**Author:** ![Madhumati](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Madhumati](https://discourse.nodered.org/u/Madhumati)\
**Post date:** [8 June 2018 10:02 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/46 "2018-06-08T10:02:52Z")

</div>

yes, it is without change node.

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [8 June 2018 10:13 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/47 "2018-06-08T10:13:05Z")

</div>

then let gauge as original with {{value }} and put in between a change node as follows

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

Or without the change node and on the value on the gauge put: {{payload.value}}

---

<div class="post-metadata">

**Author:** ![Madhumati](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@Madhumati](https://discourse.nodered.org/u/Madhumati)\
**Post date:** [8 June 2018 10:44 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/48 "2018-06-08T10:44:25Z")

</div>

Gr8 It worked now by using change node above

Thanks

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [8 June 2018 10:46 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/49 "2018-06-08T10:46:21Z")

</div>

> [@davidcgu](#):
>
> {{payload.value}}

yw, if you don't use any change node and set on the gauge {{payload.value}} it will also work

Regards

---

<div class="post-metadata">

**Author:** ![satya3383](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@satya3383](https://discourse.nodered.org/u/satya3383)\
**Post date:** [6 November 2018 02:42 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/50 "2018-11-06T02:42:02Z")

</div>

Hi,  
Can you please let me know the flow and the configs to achieve the OPC Value into a Gauge......

Thanks in Advance

BR  
Satya

---

<div class="post-metadata">

**Author:** ![indedark](https://avatars.discourse-cdn.com/v4/letter/i/fbc32d/32.png) [@indedark](https://discourse.nodered.org/u/indedark)\
**Post date:** [5 December 2020 21:17 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/51 "2020-12-05T21:17:35Z")

</div>

Sorry to open this old, old topic. I'm having trouble with this myself, and I've spent a couple days trying to figure it out.  
Problem: I have a memory address in an I2C device that gives device status:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/45b0c7230b30c489c42a3b759385b0733d10197a.png)

I can poll that address, receive an integer back, separate it into the corresponding bits. But I can't figure out how to output the 6 messages declaring the status (true or false, 1 or 0 doesn't matter) to make decisions... can someone help me?

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

```auto
[{"id":"7e15029f.3ab42c","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"8ae6db2.b5ec028","type":"i2c in","z":"7e15029f.3ab42c","name":"Lidar Status","busno":"1","address":"98","command":"1","count":"1","x":270,"y":140,"wires":[["56596c42.6e16f4","bfd11c29.08915"]]},{"id":"56596c42.6e16f4","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":140,"wires":[]},{"id":"bfd11c29.08915","type":"bitunloader","z":"7e15029f.3ab42c","name":"System Status","mode":"arrayBits","prop":"payload","padding":"8","x":460,"y":200,"wires":[["ac461ea.cc313e","32454ad1.b50786"]]},{"id":"ac461ea.cc313e","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":200,"wires":[]},{"id":"d7b05339.a4322","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":260,"wires":[]},{"id":"f19a1ef1.d72a9","type":"inject","z":"7e15029f.3ab42c","name":"","props":[{"p":"payload"},{"p":"topic","v":"topic","vt":"flow"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":140,"wires":[["8ae6db2.b5ec028"]]},{"id":"32454ad1.b50786","type":"switch","z":"7e15029f.3ab42c","name":"Separate Statuses","property":"key","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"}],"checkall":"true","repair":true,"outputs":6,"x":550,"y":380,"wires":[["caabc82a.02f858"],["1e180185.c5efde"],["6aa8bd5d.9fa4c4"],["d292ce2.ed51f3"],["177c92c8.80ac1d"],["49917ca8.400dd4"]]},{"id":"1e180185.c5efde","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":320,"wires":[]},{"id":"6aa8bd5d.9fa4c4","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":380,"wires":[]},{"id":"177c92c8.80ac1d","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":500,"wires":[]},{"id":"d292ce2.ed51f3","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":440,"wires":[]},{"id":"49917ca8.400dd4","type":"debug","z":"7e15029f.3ab42c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":990,"y":560,"wires":[]},{"id":"caabc82a.02f858","type":"change","z":"7e15029f.3ab42c","name":"Set","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":260,"wires":[["d7b05339.a4322"]]}]

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c40ff73b5e9ac5e5e406defab88e2cb25dd05bb7.png)

Before saying read this, read that, I've read and re-read it. I learn from seeing an example. I can understand and scale from there.

Please help me!

Thanking you in advance!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 December 2020 21:55 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/52 "2020-12-05T21:55:26Z")

</div>

If you want to send each one of those values in the array out of a different output then you can use a Function node with the number of outputs set to 8, containing something like

```auto
// payload contains an array of values, build an array of messages containing those values
let msgs = msg.payload.map(myFunction)
return msgs

function myFunction(x) {
    return {payload: x}
}

```

That uses the Array map() function to convert the array values into an array of messages containing those values in msg.payload.

---

<div class="post-metadata">

**Author:** ![indedark](https://avatars.discourse-cdn.com/v4/letter/i/fbc32d/32.png) [@indedark](https://discourse.nodered.org/u/indedark)\
**Post date:** [5 December 2020 22:05 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/53 "2020-12-05T22:05:11Z")

</div>

Oh, my thank you SO much! I really appreciate your help with this!

It worked!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 December 2020 22:05 UTC](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287/54 "2020-12-19T22:05:11Z")

</div>

Closed on 19 December 2020 22:05 UTC

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

[Previous page](https://discourse.nodered.org/t/how-to-seperate-value-from-incoming-msg-payload/287.md?page=2)
