# Generating a list using ui\_list-widget from MSSQL PLus

**URL:** <https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [26 January 2022 06:16 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237 "2022-01-26T06:16:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nico25](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nico25](https://discourse.nodered.org/u/nico25)\
**Post date:** [26 January 2022 06:16 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237/1 "2022-01-26T06:16:16Z")

</div>

I´ve been struggling for a while now, to format my msg.payload in a way, that it is displayed in ui\_list.

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10ad7bde432921b4de53982cdefc49d964bda29b.png)

I found this entry here in the forum:

> [@Mysql output as input for list node](https://discourse.nodered.org/t/mysql-output-as-input-for-list-node/46934):
>
> I made a dashboard for learning IR and RF codes and execute them. Storage is in mysql. I have 99% working, but the last part wont . I like to fill a list node based on devices that are 'learned'and already saved in the mysql database. So i retrieve the unique names from the devices from mysql and try to fill the list node.. I added the flow and added the different content I see the structure that comes from mysql is not the right structure for the list node... Expanation content: orgdevi…

But I didn´t really get how to solve my problem.  
Any feedback welcome.

---

<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:** [26 January 2022 10:02 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237/2 "2022-01-26T10:02:28Z")

</div>

A snippet from the help for ui\_list:  
 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7c11d2cb468e15c9b1609e9330fc1eada995abe4.jpeg)

So does it work if you change your SQL query to  
**select Toolnr as title, Model from All\_Tools where Loction = 'Werkzeugbau'**?

---

<div class="post-metadata">

**Author:** ![nico25](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nico25](https://discourse.nodered.org/u/nico25)\
**Post date:** [27 January 2022 13:40 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237/3 "2022-01-27T13:40:31Z")

</div>

I could solve it after you made me aware, that the widget needs a message.payload.title.  
So I wrote a function that iterates through the array and generates titles for every entry.

```auto
var schritt;
msg.test = msg.payload.length;
for(schritt = 0; schritt < msg.payload.length;schritt++)
{
    msg.payload[schritt].title = msg.payload[schritt].Toolnr + '-' + msg.payload[schritt].Model;

}

 return msg;

```

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/9/c940267c255946ab8c21dbe2f94e02d36bd7e61a.png)

---

<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:** [27 January 2022 13:44 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237/4 "2022-01-27T13:44:23Z")

</div>

You could just as easily have done the text concatenation and generated this title field SQL query.

---

<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:** [10 February 2022 13:44 UTC](https://discourse.nodered.org/t/generating-a-list-using-ui-list-widget-from-mssql-plus/57237/5 "2022-02-10T13:44:52Z")

</div>

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