# Gauge ui\_control used with ui\_gauge without a payload

**URL:** <https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599>\
**Category:** Dashboard\
**Created:** [20 October 2020 19:57 UTC](https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599 "2020-10-20T19:57:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Curious](https://discourse.nodered.org/u/Curious)\
**Post date:** [20 October 2020 19:57 UTC](https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599/1 "2020-10-20T19:57:44Z")

</div>

Oops, sorry about the previous post. Let me try this again.

I have read several posts about using a ui\_control with a ui\_gauge. I am trying to modify the sectors / segments and I would only want to do it once after deployment. The attached code is based on another post I saw. The problem I am having is when I send the msg without a payload I get the following error.

```auto
“TypeError: Cannot read property 'Avail|number:1' of undefined.

```

Inside the gauge I have the following in the Value Format field:

```auto
{{msg.payload.Metrics.Avail | number:1}}

```

Is it possible to change the gauge sectors / segments by just sending msg.ui\_control WITHOUT the msg.payload? (It seems like a valid msg.payload is necessary otherwise it will throw an error).

Note that if I uncomment and send the msg. payload with msg.ui\_control it works.

```auto
var seg1 = 70;
var seg2 = 90;

/*
msg.payload = {
    "Metrics": {
        "Avail": 42
    }}
        
console.log("Avail=", msg.payload.Metrics.Avail);
*/

msg.ui_control = {
    "seg1":seg1, 
    "seg2":seg2
};

return msg;

```

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [20 October 2020 21:34 UTC](https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599/4 "2020-10-20T21:34:35Z")

</div>

```auto
msg.ui_control = {
    "seg1":seg1, 
    "seg2":seg2
};
delete msg.payload
return msg;

```

But as far I know the ui\_gauge resets on options change so the outcome may not satisfy your needs.

---

<div class="post-metadata">

**Author:** ![Curious](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Curious](https://discourse.nodered.org/u/Curious)\
**Post date:** [21 October 2020 00:37 UTC](https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599/5 "2020-10-21T00:37:10Z")

</div>

Thanks for the quick reply. That seems to have done the trick!!!

---

<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 November 2020 00:37 UTC](https://discourse.nodered.org/t/gauge-ui-control-used-with-ui-gauge-without-a-payload/34599/6 "2020-11-20T00:37:12Z")

</div>

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