# UI Table with JSON UI Control

**URL:** <https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476>\
**Category:** Dashboard\
**Created:** [6 February 2021 03:22 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476 "2021-02-06T03:22:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wingkuan98](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wingkuan98/32/36617_2.png) [@wingkuan98](https://discourse.nodered.org/u/wingkuan98)\
**Post date:** [6 February 2021 03:22 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476/1 "2021-02-06T03:22:15Z")

</div>

HI,

I am using example from NodeRed examples --\> node-red-node-ui-table --\> ui\_control table.

Current program:  
"min": 0,  
"max":100,  
"color": ["red", "orange", "lime"],

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

I would like to have program like:  
"color": **\<=70: red, \>=90: green, else=orange**

My main concern is about the color with specific range I set.

Thank you and hope to get solution here!

Best regards,  
Wing

---

<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:** [6 February 2021 09:31 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476/2 "2021-02-06T09:31:32Z")

</div>

Hi I havent used this node in anger but I think you can do something like this...

```auto
// 0-9% 10-19% .....................60-69% 70-79% 80-89% 90-100%
"color": ["red", "red", "red", "red", "red", "red", "orange", "orange", "lime"],

```

---

<div class="post-metadata">

**Author:** ![wingkuan98](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wingkuan98/32/36617_2.png) [@wingkuan98](https://discourse.nodered.org/u/wingkuan98)\
**Post date:** [6 February 2021 09:47 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476/3 "2021-02-06T09:47:10Z")

</div>

Hi Steve,

Thanks for your reply. Yes I do know this way but I have 8 columns that need this function, this will make the coding even longer. Perhaps, there is one sentence code can be performed?

Thank you!

Best regards,  
Wing

---

<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:** [6 February 2021 09:50 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476/4 "2021-02-06T09:50:03Z")

</div>

As I said, i dont really use this. Yuo could create a colors variable and re-use it...

```auto
// 0-9% 10-19% .....................60-69% 70-79% 80-89% 90-100%
var colours = ["red", "red", "red", "red", "red", "red", "orange", "orange", "lime"];
...
...
//later on - use it multiple times
[
  { "color": colours, } ,
  { "color": colours, } ,
  { "color": colours, } ,
  { "color": colours, } ,
  { "color": colours, } ,
]

```

---

<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:** [21 February 2021 09:30 UTC](https://discourse.nodered.org/t/ui-table-with-json-ui-control/40476/6 "2021-02-21T09:30:38Z")

</div>

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