# Dropdown list gets overwritten. Only one item in list

**URL:** <https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216>\
**Category:** General\
**Created:** [1 September 2022 12:15 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216 "2022-09-01T12:15:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pat1](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@pat1](https://discourse.nodered.org/u/pat1)\
**Post date:** [1 September 2022 12:15 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216/1 "2022-09-01T12:15:55Z")

</div>

![bilde](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e7c4359a7d86173c496198ed742825747280db99.png)

I'm trying to populate a dropdown with the options propery in the picture.  
A change-node gives me a few objects like the one above.

The dropdown gets populated with the msg.options, but only last item is shown. So I guess it overwrites for each object.

I could not make the Join node work for this.

❔

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 September 2022 12:59 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216/2 "2022-09-01T12:59:55Z")

</div>

if you are getting multiple messages with a single option string, you will need to join the options into an array, or save to context storage. The msg.complete in your msg object would probably interfere with the join node, you may want to delete it unless it's there to denote the last msg part for the join. It may help to see a flow that is causing the join issue.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 September 2022 13:40 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216/3 "2022-09-01T13:40:08Z")

</div>

> [@pat1](#):
>
> I could not make the Join node work for this.

Show us how you have configured the Join node and what you get out of it.

---

<div class="post-metadata">

**Author:** ![pat1](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@pat1](https://discourse.nodered.org/u/pat1)\
**Post date:** [1 September 2022 14:10 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216/4 "2022-09-01T14:10:32Z")

</div>

Thanks for reaching out.

I just did a merge and a function node.

```auto
msg.options = [msg.payload.options]
for (var i = 0; i < msg.payload.length; i++) {
    msg.options[i] = msg.payload[i].options
}

return msg;

```

That worked fine. There is propably a way to accomplish this wihtout a function too.

---

<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:** [31 October 2022 14:11 UTC](https://discourse.nodered.org/t/dropdown-list-gets-overwritten-only-one-item-in-list/67216/5 "2022-10-31T14:11:30Z")

</div>

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