# UI Text Formatting

**URL:** <https://discourse.nodered.org/t/ui-text-formatting/90281>\
**Category:** General\
**Created:** [20 August 2024 01:01 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281 "2024-08-20T01:01:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RGAnthony](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@RGAnthony](https://discourse.nodered.org/u/RGAnthony)\
**Post date:** [20 August 2024 01:01 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/1 "2024-08-20T01:01:46Z")

</div>

Hey all, I have a SQL database linked and running a query that outputs a payload and I am able to select it individually by msg.payload.rows[0] etc, but when trying to display it on the UI I can't figure out how to display just the value inside quotations. Any assistance would be greatly appreciated!

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57d0f6983849fa3c3cc5e5649922fc2d2246a49e.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/69dc9760a7a4c780aa860f82e1389ac804a4478d.png)

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [20 August 2024 01:08 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/2 "2024-08-20T01:08:50Z")

</div>

show the output of debug 1. copy and paste.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [20 August 2024 01:45 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/3 "2024-08-20T01:45:11Z")

</div>

Your problem will be made a bit simpler if you change your query a bit

SELECT blah, blah, SUBSTR(CNTR\_DESC, 1, 8) **AS desc** , blah, blah from blah...

The value "1G030142" then becomes `msg.payload.rows[0].desc` or (in a template) `msg.payload.rows.0.desc`

Edit: `desc` is no doubt a reserved word. Use some other alias eg `shortdesc`

---

<div class="post-metadata">

**Author:** ![RGAnthony](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@RGAnthony](https://discourse.nodered.org/u/RGAnthony)\
**Post date:** [20 August 2024 01:45 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/4 "2024-08-20T01:45:25Z")

</div>

SELECT \* FROM ( SELECT DISTINCT substr(cntr\_desc, 1, 8) FROM v\_rt\_shift\_oee\_calc ORDER BY DBMS\_RANDOM.RANDOM) WHERE rownum \< 11 : msg : Object

object

payload: object

metaData: array[1]

rows: array[10]

0: object

1: object

2: object

3: object

4: object

5: object

6: object

7: object

8: object

9: object

topic: "SELECT \* FROM ( SELECT DISTINCT substr(cntr\_desc, 1, 8) FROM v\_rt\_shift\_oee\_calc ORDER BY DBMS\_RANDOM.RANDOM) WHERE rownum \< 11"

event: object

socketid: "X1rZgd20towjSWsqAAAF"

\_msgid: "1ba0387e7ae4baf6"

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [20 August 2024 01:52 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/5 "2024-08-20T01:52:34Z")

</div>

sorry, i wasn't clear. open any one object completely of the debug output and paste the value.  
also, if you could follow @jbudd advice, the result will be simpler to implement

---

<div class="post-metadata">

**Author:** ![RGAnthony](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@RGAnthony](https://discourse.nodered.org/u/RGAnthony)\
**Post date:** [20 August 2024 01:55 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/6 "2024-08-20T01:55:55Z")

</div>

rows: array[10]

0: object

SUBSTR(CNTR\_DESC,1,8): "1H080104"

1: object

2: object

SUBSTR(CNTR\_DESC,1,8): "1B010211"

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [20 August 2024 02:41 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/7 "2024-08-20T02:41:04Z")

</div>

sorry forgot to ask, is this dashboard 1 or dashboard 2.0 ?

assuming, dashboard 1,  
try this in the ui-text

```auto
[{"id":"91326ae9c1b76ad6","type":"ui_text","z":"4cde86148e5b95f7","group":"6339e2ead216512f","order":4,"width":0,"height":0,"name":"","label":"","format":"{{payload[0]SUBSTR(CNTR_DESC,1,8)}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":775,"y":1600,"wires":[]},{"id":"6339e2ead216512f","type":"ui_group","name":"Group 2","tab":"5e0dd10e66fdea95","order":2,"disp":false,"width":"30","collapse":false,"className":""},{"id":"5e0dd10e66fdea95","type":"ui_tab","name":"TEST","icon":"dashboard","order":9,"disabled":false,"hidden":false}]

```

also if you would have followed @jbudd advice, it would have been simpler.

---

<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:** [18 November 2024 02:41 UTC](https://discourse.nodered.org/t/ui-text-formatting/90281/8 "2024-11-18T02:41:29Z")

</div>

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