# Concatenate labels of selected values in multiselect enabled dropdown

**URL:** <https://forum.inductiveautomation.com/t/concatenate-labels-of-selected-values-in-multiselect-enabled-dropdown/31706>\
**Category:** Ignition\
**Created:** [January 29, 2020, 8:29am UTC](https://forum.inductiveautomation.com/t/concatenate-labels-of-selected-values-in-multiselect-enabled-dropdown/31706 "2020-01-29T08:29:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guganathan.r](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@guganathan.r](https://forum.inductiveautomation.com/u/guganathan.r)\
**Post date:** [January 29, 2020, 8:29am UTC](https://forum.inductiveautomation.com/t/concatenate-labels-of-selected-values-in-multiselect-enabled-dropdown/31706/1 "2020-01-29T08:29:39Z")

</div>

Hi,

I’m using a dropdown with multiselect enabled to allow users to select multiple options on it. How do I get all labels of selected values and concatenate with ‘/’ separation between each item. I need to write these concatenated labels to SQL database.

---

<div class="post-metadata">

**Author:** ![guganathan.r](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@guganathan.r](https://forum.inductiveautomation.com/u/guganathan.r)\
**Post date:** [January 29, 2020, 9:34am UTC](https://forum.inductiveautomation.com/t/concatenate-labels-of-selected-values-in-multiselect-enabled-dropdown/31706/2 "2020-01-29T09:34:45Z")

</div>

I managed to do it this way and it works.

Created a custom label as selectedlabel with expression binding on {this.props.value} and a script transform as follow:

```
  x = ""
  mylist = self.props.value
  myoptions = self.props.options
  selLabels = []

  for i in mylist:
    for j in range(len(self.props.options)):
		if self.props.options[j].value == i:
			selLabels.append(self.props.options[j].label)
    x = '/'.join(selLabels) 
   return x

```

Please let me know if there is anyother simplest form to obtain this result.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 29, 2020, 4:56pm UTC](https://forum.inductiveautomation.com/t/concatenate-labels-of-selected-values-in-multiselect-enabled-dropdown/31706/3 "2020-01-29T16:56:04Z")

</div>

There’s no ‘better’ way to do it than to loop through the possible options and compare them with the selected values, no. You can make the script a little cleaner using a list comprehension; create a custom property with a property binding to `self.props.value`, and then add a script transform:  
`return "/".join(o.label for v in value for o in self.props.options if o.value == v)`  
But it’s the same script as what you’ve written.
