# UI Dropdown - get result from SQL

**URL:** <https://discourse.nodered.org/t/ui-dropdown-get-result-from-sql/614>\
**Category:** Dashboard\
**Created:** [5 June 2018 09:46 UTC](https://discourse.nodered.org/t/ui-dropdown-get-result-from-sql/614 "2018-06-05T09:46:40Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 August 2018 21:25 UTC](https://discourse.nodered.org/t/ui-dropdown-get-result-from-sql/614/17 "2018-08-06T21:25:29Z")

</div>

Based on the screenshot of the data you have in this post - [UI Dropdown - get result from SQL](https://discourse.nodered.org/t/ui-dropdown-get-result-from-sql/614/8?u=knolleary)

You can either use a Function node with:

```auto
msg.options = msg.payload.map(function(value) {
    var v = {};
    v[value.location] = value.id;
    return v;
})
return msg;

```

Or a Change node, configured to "Set `msg.options` to the expression: `$.payload.{location:id}`

---

_[View the full topic](https://discourse.nodered.org/t/ui-dropdown-get-result-from-sql/614)._
