# Programmatically change range in Dashboard numeric input

**URL:** <https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [5 January 2023 17:13 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240 "2023-01-05T17:13:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmtkelly](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jmtkelly](https://discourse.nodered.org/u/jmtkelly)\
**Post date:** [5 January 2023 17:13 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/1 "2023-01-05T17:13:05Z")

</div>

I am trying to use a numeric input on the dashboard and am wanting to programatically change the range.  
I can see in the numeric properties where you can set the min and max. I tried to use a variable in the max field but it didn't like that. Has anyone had any success doing this?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 January 2023 17:24 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/2 "2023-01-05T17:24:44Z")

</div>

> <https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md#ui-widget-configuration-via-msgui_control>

---

<div class="post-metadata">

**Author:** ![jmtkelly](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jmtkelly](https://discourse.nodered.org/u/jmtkelly)\
**Post date:** [5 January 2023 17:54 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/3 "2023-01-05T17:54:04Z")

</div>

so I would set the ui\_numeric.max = some\_variable? There is no where in the actual dashboard node properties **ui numeric** to place code so I am guessing I would have to do this elsewhere like perhaps in a function node? I named the ui\_numeric " **height\_input**" and tried to set **height\_input.max = variable** in a function however I am getting an error as the function does not know what "height\_input.max" is.

---

<div class="post-metadata">

**Author:** ![mudwalker](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mudwalker](https://discourse.nodered.org/u/mudwalker)\
**Post date:** [5 January 2023 18:03 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/4 "2023-01-05T18:03:41Z")

</div>

Using @Steve-Mcl link above I was able to write this flow.

```auto
[{"id":"791b6ee270a58b19","type":"ui_numeric","z":"0e2cba8a481c3fb9","name":"","label":"numeric","tooltip":"","group":"60c7705.396ef1","order":9,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":10,"step":1,"className":"","x":880,"y":620,"wires":[[]]},{"id":"cf4427c44004c770","type":"change","z":"0e2cba8a481c3fb9","name":"","rules":[{"t":"set","p":"msg.ui_control","pt":"msg","to":"{ \"min\":10, \"max\":50 }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":620,"wires":[["791b6ee270a58b19"]]},{"id":"735569bf960a545f","type":"inject","z":"0e2cba8a481c3fb9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":500,"y":620,"wires":[["cf4427c44004c770"]]},{"id":"60c7705.396ef1","type":"ui_group","name":"Scheduler","tab":"b7237e1.8d991","order":1,"disp":false,"width":"6","collapse":false},{"id":"b7237e1.8d991","type":"ui_tab","name":"Scheduler","icon":"autorenew","order":3,"disabled":false,"hidden":false}]

```

I would presume that the only items that can be changed are those described in the linked document. But I hasten to add, I am no expert! I didn't know you could do this until reading this thread.

You might want to heed the following note...  
_ **Note** : It is still recommended that nodes are configured via the editor in order to preset the default values._

---

<div class="post-metadata">

**Author:** ![jmtkelly](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jmtkelly](https://discourse.nodered.org/u/jmtkelly)\
**Post date:** [5 January 2023 19:03 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/5 "2023-01-05T19:03:18Z")

</div>

I imported your flow but still can't manage to dynamically set the max. The issue is that the "max" value comes from a flow variable. I tried changing { "min":10, "max":10 } to { "min":10, "max":flow.get('max\_range') } but it throws an error.

---

<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:** [4 February 2023 19:03 UTC](https://discourse.nodered.org/t/programmatically-change-range-in-dashboard-numeric-input/73240/6 "2023-02-04T19:03:29Z")

</div>

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