# UI Gauge - Splitting data before sending to Gauge

**URL:** <https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [27 February 2024 13:02 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954 "2024-02-27T13:02:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SabreFrenzy](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@SabreFrenzy](https://discourse.nodered.org/u/SabreFrenzy)\
**Post date:** [27 February 2024 13:02 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/1 "2024-02-27T13:02:58Z")

</div>

Hi,  
I have the following data entering node red.

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

I want to display CV01\_Rate on a Gauge UI (Dashboard 2.0). When I get the following:

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

I believe need to extract the CV01\_Rate data from the initial message. If I use a debug node and use payload.CV01\_Rate I get only the data I need.

What function do I need to place between my source and gauge end point?

Many thanks for any help in advance.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [27 February 2024 13:12 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/2 "2024-02-27T13:12:32Z")

</div>

You do not have to split it, you can use the value format field and enter  
`{{msg.payload.CV01_Rate | number : 2}}` the number : 2 will format it to 2 decimal places.

If you really need to split the object then a split node and switch node to route is the easiest route.  
e.g.

```auto
[{"id":"54e60a80d26d8c2b","type":"inject","z":"d1395164b4eec73e","name":"if order can be different","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CV01_Rate1\":15.12345678,\"CV01_Rate2\":16.12345678}","payloadType":"json","x":540,"y":7360,"wires":[["e8f3faaab5afb0df"]]},{"id":"e8f3faaab5afb0df","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":710,"y":7360,"wires":[["ad03663e3fc51aa7"]]},{"id":"ad03663e3fc51aa7","type":"switch","z":"d1395164b4eec73e","name":"route on parts.key","property":"parts.key","propertyType":"msg","rules":[{"t":"eq","v":"CV01_Rate1","vt":"str"},{"t":"eq","v":"CV01_Rate2","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":710,"y":7420,"wires":[["fcbf5eb9b794a3fb"],["dc6a916b731cde9d"]]},{"id":"fcbf5eb9b794a3fb","type":"debug","z":"d1395164b4eec73e","name":"msg.payload.val","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":980,"y":7360,"wires":[]},{"id":"dc6a916b731cde9d","type":"debug","z":"d1395164b4eec73e","name":"msg.payload.val","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"error_count","statusType":"auto","x":980,"y":7420,"wires":[]}]

```

---

<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:** [27 February 2024 13:36 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/3 "2024-02-27T13:36:41Z")

</div>

> [@SabreFrenzy](#):
>
> What function do I need to place between my source and gauge end point?

For the next time, if you need to do something similar that is what the Change node is for.

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Also

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

---

<div class="post-metadata">

**Author:** ![SabreFrenzy](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@SabreFrenzy](https://discourse.nodered.org/u/SabreFrenzy)\
**Post date:** [27 February 2024 15:55 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/4 "2024-02-27T15:55:55Z")

</div>

Thanks E1cid, but i was using the new 2.0 Dashboard where the Gauge parameter for valve is not accessible like in v1.0, I was already doing as you suggested in v1.0:

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

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

In V2.0 I couldn't see where I can assign a single parameter.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [27 February 2024 16:21 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/5 "2024-02-27T16:21:01Z")

</div>

My mistake .

Then use the spllt flow example i provided or use a change node and set mag.payload to msg.payload.CV01\_Rate, prior to the gauge. You will also need to round the value prior to sending to gauge  
e.g.

```auto
[{"id":"0713967da54e4bd4","type":"inject","z":"e1ef5728e9206b4a","name":"if order can be different","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CV01_Rate1\":15.12345678,\"CV01_Rate2\":16.12345678}","payloadType":"json","x":140,"y":600,"wires":[["bd97cabbea4f2f3c"]]},{"id":"bd97cabbea4f2f3c","type":"split","z":"e1ef5728e9206b4a","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":310,"y":600,"wires":[["a09b20f6bd11103c"]]},{"id":"a09b20f6bd11103c","type":"change","z":"e1ef5728e9206b4a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round($$.payload,1)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":660,"wires":[["aacbcbe5483832d0"]]},{"id":"aacbcbe5483832d0","type":"switch","z":"e1ef5728e9206b4a","name":"route on parts.key","property":"parts.key","propertyType":"msg","rules":[{"t":"eq","v":"CV01_Rate1","vt":"str"},{"t":"eq","v":"CV01_Rate2","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":660,"wires":[["32dbde3b7f509a6e"],["3da1c9db86ff4fcb"]]},{"id":"3da1c9db86ff4fcb","type":"debug","z":"e1ef5728e9206b4a","name":"msg.payload.val","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"error_count","statusType":"auto","x":580,"y":660,"wires":[]},{"id":"32dbde3b7f509a6e","type":"debug","z":"e1ef5728e9206b4a","name":"msg.payload.val","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":580,"y":600,"wires":[]}]

```

I will edit the category to dashboard D2 also.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [27 February 2024 17:29 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/6 "2024-02-27T17:29:08Z")

</div>

You can use a "[Change](https://flowfuse.com/node-red/core-nodes/change/)" node in Node-RED and set `msg.payload` to `msg.payload.CV01_Rate`

---

<div class="post-metadata">

**Author:** ![SabreFrenzy](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@SabreFrenzy](https://discourse.nodered.org/u/SabreFrenzy)\
**Post date:** [27 February 2024 20:12 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/7 "2024-02-27T20:12:02Z")

</div>

E1cid, cheers for the examples I now understand how you got what I needed and it's working great.

---

<div class="post-metadata">

**Author:** ![SabreFrenzy](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@SabreFrenzy](https://discourse.nodered.org/u/SabreFrenzy)\
**Post date:** [27 February 2024 20:13 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/8 "2024-02-27T20:13:51Z")

</div>

joepavitt,

Thanks for your response, I had tried that a number of times but I must have got the syntax wrong as I tried your method again and it too works.

I think I was going around in circles trying to get it to work!

---

<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:** [12 March 2024 20:14 UTC](https://discourse.nodered.org/t/ui-gauge-splitting-data-before-sending-to-gauge/85954/9 "2024-03-12T20:14:45Z")

</div>

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