# Perspective drodown selected label

**URL:** <https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [September 16, 2020, 12:44am UTC](https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723 "2020-09-16T00:44:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 16, 2020, 12:44am UTC](https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723/1 "2020-09-16T00:44:40Z")

</div>

I want to get the selected label from a perspective dropdown. This post helped...

> [@Perspective: How do I grab the text property of a dropdown menu?](http://forum.inductiveautomation.com/t/perspective-how-do-i-grab-the-text-property-of-a-dropdown-menu/24371/4):
>
> I appreciate the info on that part of the question. I am now using the gateway’s logs for my current debugging needs.

But, if using showClearIcon and then clearing you will get stale data. Are there any better alternatives to getting the selected label?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 16, 2020, 1:14am UTC](https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723/2 "2020-09-16T01:14:09Z")

</div>

With a few modifications, that linked script will still do what you want. You just ned to handle the case where the value (empty String) does not match any row of the dataset, and then return an appropriate value.

```auto
    data = self.props.options
    value_found = False
	for row in range(data.getRowCount()):
		if (data.getValueAt(row, "value") == self.props.value):
			self.custom.displayvalue = data.getValueAt(row, "label")
            value_found = True
			break
    if not value_found:
        return "someOtherValue"

```

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 16, 2020, 1:26am UTC](https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723/3 "2020-09-16T01:26:47Z")

</div>

Thanks, that’s what I ended up doing. Just making sure that was still the best way to go about it.

---

<div class="post-metadata">

**Author:** ![tebright1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tebright1/32/87405_2.png) [@tebright1](https://forum.inductiveautomation.com/u/tebright1)\
**Post date:** [April 5, 2024, 8:28pm UTC](https://forum.inductiveautomation.com/t/perspective-drodown-selected-label/38723/4 "2024-04-05T20:28:54Z")

</div>

For those referencing the code here. Sorry for the bump.

Caught a typo:

```auto
if not value_found:
        return 'someOtherValue"

```

Update to:

```auto
 if not value_found:
        return 'someOtherValue'

```
